phibr0 / obsidian-emoji-shortcodes

Emoji Shortcodes - Obsidian Plugin | Adds Support for Emoji Shortcodes to Obsidian
MIT License
181 stars 15 forks source link

Dataview and Tasks performance issues #47

Open hpr1999 opened 1 year ago

hpr1999 commented 1 year ago

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.)

bwydoogh commented 11 months ago

Encountering the same issue.

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

KraXen72 commented 10 months ago

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.

bwydoogh commented 10 months ago

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.

KraXen72 commented 10 months ago

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.

claremacrae commented 7 months ago

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:

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

KraXen72 commented 7 months ago

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?

claremacrae commented 7 months ago

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 commented 7 months ago

@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....

KraXen72 commented 7 months ago

@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 commented 7 months ago

@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!

claremacrae commented 7 months ago

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

bwydoogh commented 7 months ago

@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.

KraXen72 commented 7 months ago

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.

claremacrae commented 7 months ago

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 commented 7 months ago

@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

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 commented 7 months ago

@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

bwydoogh commented 7 months ago

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.

KraXen72 commented 7 months ago

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 commented 7 months ago

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.

claremacrae commented 7 months ago

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

KraXen72 commented 7 months ago

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 commented 7 months ago

@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 😄