Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lag when scrolling decorations in vim mode #814

Open
BBazard opened this issue Jan 1, 2025 · 1 comment
Open

Lag when scrolling decorations in vim mode #814

BBazard opened this issue Jan 1, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@BBazard
Copy link

BBazard commented Jan 1, 2025

Is the bug present when using the default Obsidian theme?

No

Is the bug present when snippets and plugins are disabled?

Yes

Minimal theme version

7.7.18

Describe the bug

How to reproduce

  1. Create a new Vault (reproduced in desktop mode)
  2. Enable vim mode (Editor > Vim key bindings)
  3. Install and enable Minimal Theme (Appearance > Themes > Manage)
  4. Create a file with decorations (reproduced with an empty line followed by 500 lines of - [x] xxx)
  5. Go to the first empty line in vim normal mode
  6. Press j and stay pressed to scroll down one line at a time (to trigger the codemirror decorations of the checklists)

This results in a high CPU load which can cause lags.

More precision

  • no issue with default theme
  • no issue in source mode
  • the issue still exists when not in vim mode, scrolling with the down arrow key
  • with a good enough CPU no lag is apparent, just a high CPU load
  • with a 4x slowdown from devtools on my computer, the lag becomes clear (no lag on default theme or source mode even with a 4x slowdown)

Investigation

The slowness comes from the CSS, notably the CSS related to the classes is-readable-line-width and native-scrollbars.

After disabling Editor > Readable line length and removing the CSS rules related to .native-scrollbars (restart needed after editing the theme.css) the lag (almost) disappears in 4x slowdown.

I attached a Performance Profile following # How to reproduce with the options advanced paint instrumentation (slow) and selector stats (slow). I didn't wait until everything was processed because it takes too much time with the instrumentation, I am pressing j without seeing any visual feedback.

Trace-20250101T182708.json.zip

image

Elsewhere

Seems related to #798 and https://forum.obsidian.md/t/obsidian-cursor-cannot-keep-up-with-high-key-repeat-frequency/48681/8

PS: Thank you for the Minimal Theme 🙂, I have been using it for years.

Debug info

SYSTEM INFO:
Obsidian version: v1.7.7
Installer version: v1.7.7
Operating system: #1 SMP PREEMPT_DYNAMIC Fri, 27 Dec 2024 14:24:37 +0000 6.12.7-arch1-1
Login status: not logged in
Language: en
Insider build toggle: off
Live preview: on
Base theme: adapt to system
Community theme: Minimal v7.7.18
Snippets enabled: 0
Restricted mode: on

RECOMMENDATIONS:
Custom theme and snippets: for cosmetic issues, please first try updating your theme and disabling your snippets. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community theme and snippets.

@BBazard BBazard added the bug Something isn't working label Jan 1, 2025
@codicem-ex-cinere
Copy link

codicem-ex-cinere commented Feb 7, 2025

Thank you BBazard so much for posting this solution (disabling readable line length). Obsidian responsiveness seems to have been slowing down for what seems like the last couple months, and now I can finally use it again. I never tried removing .native-scrollbars from the theme as the first issue alone seemed to provide sufficient speed increases.

Over the months since this bug was introduced (4,5?), I have tried testing potential solutions and nothing other than disabling Minimal theme made much of a difference - also tested in the sandbox vault with / without minimal theme and still cursor-scroll-lag increases to 300-400+ms per INP in the dev performance summary. Also I don't use Vim mode so its also a more serious issue that is likely reaching a wider user base (not sure if title change to general lag would be appropriate?).. Thus, now even with many plugins and snippets enabled, my Obsidian vaults are pretty snappy again. Very very happy.

PS: Also have been a long time user of Minimal, thanks for the work on it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants