mugiwara85/CodeblockCustomizer

[BUG] Performance Degradation With Combination of Long Notes, Several Themes, Split Panes

Closed this issue · 7 comments

Overview

When using split panes, long notes, and some themes, responsiveness and performance degrades. This is most prominent with the Minimal/Things/Sanctum themes.

I figured this bug would be important because these themes are popular. I really like Codeblock Customizer but it's preventing me from using it since I use split panes frequently.

Reproduction

Took me forever to diagnose this and also make this reproducible on my computer. I'm running this on Windows 11, Obsidian 1.5.2

(might require a slower computer)

  1. Create a new vault
  2. Create a very long markdown file. See example:
    markdown-tester.md. Can also copy-paste to make it longer.
  3. IMPORTANT: Split the pane or drag a new file to split the window.
  4. Show that performance is not degraded by highlighting lots of text quickly using the mouse.
  5. Install Minimal Theme
  6. Show that performance is not degraded by highlighting lots of text quickly again.
  7. Install Codeblock Customizer and enable.
  8. Performance should suffer when highlighting lots of text quickly with the mouse.

Extra details

  1. Disable Codeblock Customizer
  2. Performance should return to normal when highlighting lots of text quickly with the mouse.
  3. Re-enable Codeblock Customizer. See the degraded performance again.
  4. Un-split (close) the panes.
  5. Performance should return to normal.

Some notes

  • I tried some other themes, performance seemed slightly worse but I couldn't tell as much, unlike with Minimal/Things/Sanctum themes.
  • Doing some inspector performance profiling, it seems to be related to events (i.e. keydown, mousedown)
  • Related to various updating functions in the app and maybe recalculating style.
  • No errors in console
  • Other plugins don't seem to have this problem with the themes
  • Disabling all settings in codeblock customizer doesn't seem to affect the performance issues.

Some things I'm not sure of

  • If it's a computer hardware or software-specific bug. Haven't tested it on another computer.
  • One time when toggling minimal theme and codeblock customizer, performance returned to normal with both on. I have no idea why and cannot reproduce it. May be remembering incorrectly.

After some more investigation it might be related to either CodeBlockHighlight.ts or the 3rd-party library pickr with moveable.js

Thanks for you detailed review. Unfortunately, in the last few weeks I was very busy, but I will definitely check out all open problems, and try to solve them during the holidays. I might get back to you, if I am having trouble reproducing something.

No problem, I totally understand, and appreciate you working on a free open-source project!

Just a heads up: I found two things, one in edit mode and multiple in css, which had an effect on performance. I will modify the css so it doesn't cause any problems. After that I will release the new version.

I just released a new version. Could you please recheck if the problem still persists or is it solved now? Thanks in advance!

Hi @mugiwara85, I did some quick testing and performance with split panes + Minimal Theme seems much improved! Thank you for your time and effort!

Hi @jeffchiou no problem. It was actually caused by 2-3 CSS selectors. There is still a little bug with split panes. I am working on It now.