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 of 0.5-1 sec in large org files #792

Closed
refaelsh opened this issue Aug 12, 2024 · 13 comments
Closed

Lag of 0.5-1 sec in large org files #792

refaelsh opened this issue Aug 12, 2024 · 13 comments
Labels
bug Something isn't working

Comments

@refaelsh
Copy link

refaelsh commented Aug 12, 2024

Describe the bug

When editing a large file (my NixOS configuration.org file is 2561 lines long) I feel a lag of 0.5-1 sec on any key press, especially in insert mode. On smaller files, there is no lag.
Here is my large NixOS configuration.org file: https://gitlab.com/-/snippets/3736795.

Steps to reproduce

Just try editing a large enough Org file, you will feel the lag immidiaty.

Expected behavior

No lag when editing large Org files.

Emacs functionality

N/A

Minimal init.lua

The same thing happens with nvim -u minimal_init.lua.

Screenshots and recordings

No response

OS / Distro

NixOS unstable

Neovim version/commit

0.10.1

Additional context

Similar issue: #443.
Not sure if its connected, but, in that issue, there was a lag of 5-6 seconds.
And, when the issue was solved, the OP stated at the end:

Now it's about 1-2 seconds, when before it was about 6 seconds

@refaelsh refaelsh added the bug Something isn't working label Aug 12, 2024
@kristijanhusak
Copy link
Member

Are you able to provide the org file, or at least a similar structure file with dummy content?
It would be helpful to know if there are a lot of links, markup stuff (italic, bold, etc), headlines, blocks, etc.

@refaelsh
Copy link
Author

Are you able to provide the org file

I've updated the very first post here. I should have done it from the begging. Good suggestion @kristijanhusak.

it would be helpful to know if there are a lot of links, markup stuff (italic, bold, etc), headlines, blocks, etc.

The only thing unusual is lots of subheadings in the Neovim section.

@kristijanhusak
Copy link
Member

Can you provide some info about your hardware? I tested your file with both my configuration and minimal init, and didn't notice any slowness.

slow-org-edit.mp4

@refaelsh
Copy link
Author

Can you provide some info about your hardware?

Gladly. It's a Dell laptop. Here is a screenshot from neofetch if that helps:
image

@kristijanhusak
Copy link
Member

Do you have similar issues when editing any other non-org bigger file that is highlighted with treesitter?
Also, I see that your used memory at this point is 5.3 of 7.8 gb. What are the numbers when you open up this file in Neovim?

@refaelsh
Copy link
Author

Also, I see that your used memory at this point is 5.3 of 7.8 gb.

This is how it is immediately after a fresh boot. I have 20 tabs open in Firefox (Librewolf). I am assuming this is the reason.

What are the numbers when you open up this file in Neovim?

When I open my large org file, the numbers barely change: they got from 66% percent occupied RAM to 67%.

@refaelsh
Copy link
Author

Do you have similar issues when editing any other non-org bigger file that is highlighted with treesitter?

No. I just tried a 3000 lines Haskell file. No lag.

@kristijanhusak
Copy link
Member

Ok, just to rule out treesitter highlighting, can you try to open up the file, disable highlighting with :lua vim.treesitter.stop() and then try to edit the file and see if there's lag?

@refaelsh
Copy link
Author

Ok, just to rule out treesitter highlighting, can you try to open up the file, disable highlighting with :lua vim.treesitter.stop() and then try to edit the file and see if there's lag?

I did as you said, and there is still a lag.

@kristijanhusak
Copy link
Member

Ok I just figured out that I'm testing with nightly Neovim. I do notice some lag with 0.10 and 0.10.1, I'll look into it.
One more question. Did this lag start recently or it's here for a longer time now?

@refaelsh
Copy link
Author

I do notice some lag with 0.10 and 0.10.1

Great! I am not crazy :-)

I'll look into it.

Thank you very much!

Did this lag start recently or it's here for a longer time now?

I've begun using this plugin, again (I tried using it once a couple of years ago, and I don't remember why I stopped), only yesterday.

kristijanhusak added a commit that referenced this issue Aug 12, 2024
@kristijanhusak
Copy link
Member

I pushed a change to master that should speed up things. Can you give it a test?

@refaelsh
Copy link
Author

I pushed a change to master that should speed up things. Can you give it a test?

I tested it with the latest master and there is no lag. Thank you!

SlayerOfTheBad pushed a commit to SlayerOfTheBad/orgmode that referenced this issue Aug 16, 2024
SlayerOfTheBad pushed a commit to SlayerOfTheBad/orgmode that referenced this issue Aug 16, 2024
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