Obsidian Cursor Cannot Keep Up with High Key Repeat Frequency

Hey,
I use Vim Mode for Obsidian. Because I like to move fast, I have increased the key repeat frequency (the number of times a key is repeated when I hold a key down). This makes Obsidian laggy. Instead of Scrolling fast, the cursor jumps, the moment I let go. This is very irritating.

Steps to reproduce

Increase key repeat speed. And move around with j/k in vim mode.

Expected result

Expect normal scrolling behavior.

Actual result

Cursor is jumpy. Also see video:

ObsidianBug

The framerate is a bit low, so it still seems jumpy after lowering key repeat speed. But in the first case, key repeat speed is high and jumpyness is apparent, after I lower it, movement is smooth.

Environment

  • Operating system:

Running on Linux (PopOs). Happens both in Appimage and im Flatpak.

  • Debug info:
    SYSTEM INFO:
    Obsidian version: v1.0.3
    Installer version: v1.0.3
    Operating system: #202210211149~1666452039~22.04~1891946 SMP PREEMPT_DYNAMIC Sat O 6.0.3-76060003-generic
    Login status: not logged in
    Insider build toggle: off
    Live preview: on
    Legacy editor: off
    Base theme: dark
    Community theme: none
    Snippets enabled: 0
    Restricted mode: on

RECOMMENDATIONS:
none


Thanks for looking into this!

  1. Does it happen in the sandbox vault?
  2. Does it happen in source mode?
  3. Does it happen here https://codemirror.net/5/demo/vim.html ?
  4. Does it happen here https://codemirror-vim--util.repl.co/ ?

is this even a vim specific problem? what happens if you don’t use vim and just use arrow down?

1 Like

Hey, good call: This is actually not a vim only problem. (1) Could reproduce in the sandbox mode with vim turned off and just using the arrow keys. Should I update the text/title? And yes (2) this also happens in source mode. It does not happen in (3) and (4).

Maybe it’s chrome problem, maybe it’s codemirror problem. I don’t know. It’s unlikely that we are going to look into this.

You can try to see if it happens here using Chrome

If it does, you can open a BR upstream.

Hey, it is not a Chrome problem. It works just fine at the link you provided. Also, no problems in VS Code or really any other app.

Ok, sad to hear. I can imagine, that most people won’t make the connection to the high key repeat speed. For a time, I though Obsidian was just suddenly super slow and buggy. So this might be a thing to point out if somebody reports performance issues. I guess the default key repeat speed also isn’t the same everywhere.

Nonetheless, thank you for taking the time.

This might be related to the reports here: Unusual lag since 1.0.0 on Windows (not Mac) - #17 by jazavchar

No, we do not believe this is connected to that.

We believe that this issue (key repeat lag) is hitting the limit of what codemirror+our patches+obsidian complex UI can do.

I am able to reproduce by artificially slowing down the CPU.

What are your computer spec exactly?

Since you are able to reproduce this problem in the sandbox vault, can you provide a performance profile?

Ctrl-shift-I/Cmd-opt-i → performance tab → record button → do the action that lags → wait → stop recording → export to file → zip it and upload it here or DM to us on discord

If it happens in source mode, send a performance profile of that too.

1 Like

I have this problem too; going up and down sometimes it can take 7-8 seconds from when I release the key for the screen to update. The lag gets noticeably worse the more panes are open. With only one pane up and down lag, but left and right work okay. With three panes open left and right also lag noticeably. There is also a big spike in cpu usage whenever a key is held down, whether there is visible lag or not.

Here are four profiles I recorded, with only one pane open, and with three panes open. All files either in preview mode or in source mode. Test vault, only vim enabled. No other applications running.

My system specs:

Operating System: openSUSE Leap 15.4
KDE Plasma Version: 5.24.4
KDE Frameworks Version: 5.90.0
Qt Version: 5.15.2
Kernel Version: 5.14.21-150400.24.33-default (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-6700T CPU @ 2.80GHz
Memory: 15.5 GiB of RAM
Graphics Processor: Mesa DRI Intel® HD Graphics 530

SYSTEM INFO:
Obsidian version: v1.0.3
Installer version: v0.15.9
Operating system: #1 SMP PREEMPT_DYNAMIC Fri Nov 4 13:55:06 UTC 2022 (76cfe60) 5.14.21-150400.24.33-default
Login status: not logged in
Insider build toggle: off
Live preview: on
Legacy editor: off
Base theme: dark
Community theme: none
Snippets enabled: 0
Restricted mode: on

RECOMMENDATIONS:
none

Profiles:

I hope this helps.

I don’t think you have the same problem.

Does it happen when vim is not enabled and you just scroll with arrows?

Does it happen in the sandbox vault and source mode?

If so, attach a performance profile in that case.

You have an oldish CPU too.

Does it happen when vim is not enabled and you just scroll with arrows?

Yes

Does it happen in the sandbox vault and source mode?

Yes

If so, attach a performance profile in that case.

Same as before. It’s more pronounced with more panes open. Left and right works better and degrades with use.

I’ve got the same problem, with significant lag moving the cursor up and down, and no noticeable lag moving the cursor left to right. The cursor will disappear when I hold j/k/up/down until these keys are released, at which point the cursor will reappear. Not quite the 7-8 second lag reported by tprotopopescu, but similar to bobsenrie’s video.
I usually have my key repeat rate set to 80Hz. I find that the lag doesn’t disappear until I lower the repeat rate to around 20Hz, which is much slower than I would like.

I’ve attached a performance profile for a bare vault.
My CPU is i5-8250U @ 1.60GHz.
This is also running Manjaro Linux, if that is significant.
Hope this helps!

Profile-20221208T133523.json.zip (1.3 MB)

I also don’t have this problem in the in-browser instances of Code Mirror

These also seem related: