obsidian-emoji-shortcodes icon indicating copy to clipboard operation
obsidian-emoji-shortcodes copied to clipboard

Dataview and Tasks performance issues

Open hpr1999 opened this issue 11 months ago • 22 comments

Hi there, nice plugin.

I'm not sure whether to raise this here or with Dataview, but I've discovered that enabling this plugin can cause some of my dataview tables to render about 3x slower.

I've prepared a test vault. test.zip

Just open on Dataview.md, wait for it to render. This takes about 3 seconds on my machine. Then, open another file and enable the plugin. Finally, open Dataview.md again. This takes about 9 seconds on my machine.

Thanks for your time :)

(I have also raised this with a certain theme which makes this problem even worse - but my times here were tested with the default theme.)

hpr1999 avatar Sep 17 '23 16:09 hpr1999

Encountering the same issue.

I don't know if this plugin is still maintained 🤷‍♂️.

bwydoogh avatar Nov 26 '23 11:11 bwydoogh

i have rewritten significant parts of this plugin here and i am waiting for it's approval here. Feel free to use my improved version, as i plan to maintain it further.

KraXen72 avatar Dec 07 '23 00:12 KraXen72

I tried your version, but I am not noticing any performance improvement with regards to Dataview. If I can help any further, let me know.

bwydoogh avatar Dec 07 '23 05:12 bwydoogh

interesting, i thought the rewrite would help. i can test it later and let you know if i figured it out or if you could test some stuff further.

KraXen72 avatar Dec 07 '23 17:12 KraXen72

Similarly, I had noticed that the Tasks plugin's rendering of task search results had slowed down for me recently.

Some hours of profiling and experimenting has revealed that this plugin was increasing the time to show 1,000 tasks in a search:

  • from: 1.1 seconds
  • to 4.2 seconds

I get this warning when profiling, once per task rendered:

image

The purple is the majority of the per-task render time - and clicking on the warning gives this - note the reference to EmojiMarkdownPostProcessor:

image

claremacrae avatar Mar 24 '24 22:03 claremacrae

i guess for my version I can add toggle & a warning for the markdown pre-processor, as well as (by default) not apply it to tasks or dataview elements. any other ideas?

KraXen72 avatar Mar 24 '24 23:03 KraXen72

The following is speculation based on no knowledge of the intention of this plugin but.... 😄

It seems to me that the purpose of this plugin is to help users to display emojis in text that they are typing....

In which case, it's not obvious to me that this plugin should act on any code blocks at all???

In other words, should it just ignore any code blocks?

claremacrae avatar Mar 24 '24 23:03 claremacrae

@hpr1999 May I please ask a favour. Would you be willing edit the title of this report to say 'Dataview and Tasks' for visibility...

I considered adding a second issue, but that just seemed like diluting info....

claremacrae avatar Mar 25 '24 07:03 claremacrae

@claremacrae I've logged out the elements the emojiPostProcessor encounters, and it's just a bunch of divs and spans that get rendered either by obsidian or by dataview, so i can't easily filter and skip them. I'm looking if i can speed up the processor somehow in my fork emoji-autocomplete - (it's published on the obsidian plugin store already, and is a superset of this plugin.)

KraXen72 avatar Mar 25 '24 15:03 KraXen72

@claremacrae @bwydoogh I've just released version 1.4.0 of emoji-autocomplete, which adds a bunch of optimizations to the EmojiMarkdownProcessor. Please test it out and let me know if the performance has improved. Thanks!

KraXen72 avatar Mar 25 '24 15:03 KraXen72

@KraXen72 Many thanks for this. I will test it out when I can, but am very busy at the moment.

claremacrae avatar Mar 25 '24 17:03 claremacrae

@claremacrae @bwydoogh I've just released version 1.4.0 of emoji-autocomplete, which adds a bunch of optimizations to the EmojiMarkdownProcessor. Please test it out and let me know if the performance has improved. Thanks!

Performance is better, but I disabled it again; when editing a task for example ... still a lot of lag.

bwydoogh avatar Mar 26 '24 06:03 bwydoogh

i have only tested it with the dataview plugin, for which it improved. i'll try to see what causes the lag for tasks specifically.

KraXen72 avatar Mar 26 '24 07:03 KraXen72

Thank you.

I found with Tasks that drawing a list of 200 tasks took 4 times as long with this plugin enabled as with disabled.

To get the speed up, I had to

  1. disable the plugin,
  2. close all tabs that had had Tasks queries in,
  3. restart Obsidian.

claremacrae avatar Mar 26 '24 08:03 claremacrae

@claremacrae @bwydoogh I've just released version 1.4.0 of emoji-autocomplete, which adds a bunch of optimizations to the EmojiMarkdownProcessor. Please test it out and let me know if the performance has improved. Thanks!

I just installed Emoji Autocomplete and spent a bunch of time getting timings, and finding that its performance was much the same as Emoji Shortcodes.

image

  • X axis: number of tasks displayed in the Tasks code block (code equivalent to Tasks 6.2.0)
  • Y axis: time in milliseconds

Only to discover that 1.3.0 had installed, not 1.4.0.

I don't have time to go through that all over again.

claremacrae avatar Mar 26 '24 22:03 claremacrae

@claremacrae @bwydoogh I've just released version 1.4.0 of emoji-autocomplete, which adds a bunch of optimizations to the EmojiMarkdownProcessor. Please test it out and let me know if the performance has improved. Thanks!

Performance is better, but I disabled it again; when editing a task for example ... still a lot of lag.

See above - you would have been testing with 1.3.0, not 1.4.0 - because of https://github.com/KraXen72/obsidian-emoji-autocomplete/issues/3

claremacrae avatar Mar 27 '24 09:03 claremacrae

See above - you would have been testing with 1.3.0, not 1.4.0 - because of KraXen72#3

I saw it; uninstalled the plug-in and reinstalled as I thought it would install the latest source code (but with a manifest.json file mentioning 1.3.0). Seems it doesn't work like that 🙂; improvements I noticed could come from Obsidian itself, of course. Anyway, looking forward to a 1.4.0 release.

bwydoogh avatar Mar 27 '24 09:03 bwydoogh

i just released 1.4.1 and fixed the manifest issue (1.4.1 is a tiny fix compared to 1.4.0, nothing to do with the emoji processor, only fixes an edge case with the flag font)

KraXen72 avatar Mar 27 '24 10:03 KraXen72

regarding the tasks performance: I installed the tasks plugin and created a

tasks not done
limit 250

query i could not see any difference in the performance enabled or disabled the emoji-autocomplete using 1.4.1.

KraXen72 avatar Mar 27 '24 13:03 KraXen72

Yes, Emoji AutoComplete 1.4.1 with its default settings has fixed its v1.3.0 performance problems with performance of rendering Tasks search results. Thank you.

image

claremacrae avatar Mar 27 '24 17:03 claremacrae

That's wonderful news! I am glad that it's resolved! I once again thank you for the time and effort you put into resolving this issue, as well as measuring the performance several times @claremacrae

TL;DR for anyone experiencing the same issue, feel free to migrate over to my plugin Emoji Autocomplete which fixes this issue. Install link | Git repo

note: Emoji Autocomplete is a fork of Emoji Shortcodes. However, since forking it, i have re-written the majority, if not the entirity of it, so I would say it's fair to consider it a new plugin which fulfills the same purpose with some extra features on top.

KraXen72 avatar Mar 27 '24 21:03 KraXen72

@phibr0, since Emoji Autocomplete is a fork of Emoji Shortcodes and uses the same MIT license, you're not only allowed but encouraged to implement the changes, so Emoji Shortcodes does not slow down Dataview and Tasks rendering 😄

KraXen72 avatar Mar 27 '24 21:03 KraXen72