CSS selectors performance issue
When I drag a file, worse if it seats at the root of the vault, there is quite a noticeable lag. I profiled it with css selector stats and seems like this plugin uses too much global selectors?
Not sure how it could it be improved, but probably should only be injecting CSS styles inside a editor tab, and not other kinds of editor leaves.
-
Regular selector starts: takes like 30ms (profiler with selector starts slows everything down tho)
-
With this plugin: takes like 130ms (references to style-sheet-XXX-17 are linked to the plugin)
So other plugins/themes/snippets also produce slowdowns due to CSS selections
- e.g. in this testing environment the Excalidraw plugin increases the selector to 60ms
But I think it could be improved for this plugin
Regards
Yes, I totally agree. I have to be hones, I hate CSS, and don't even know that good. But I will look at it. Most of the time when a lagging is noticable it is a wrong CSS selector. Which theme are you using? (That is also often a factor)
The default one. With a few snippets that increase the test from 15ms to 30ms, so it seems fine. This only happened when dragging a file around so it's not horrible tho.
It definitely could be improved. As I said, I hate CSS, so I did definitely some things not correctly. I will debug, maybe I can find out, which one causes issues.