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

Refresh line_types cause performance degradation(probably) #89

Closed
fecet opened this issue Aug 10, 2023 · 3 comments · Fixed by #90
Closed

Refresh line_types cause performance degradation(probably) #89

fecet opened this issue Aug 10, 2023 · 3 comments · Fixed by #90
Labels
bug Something isn't working

Comments

@fecet
Copy link
Sponsor Contributor

fecet commented Aug 10, 2023

During may hack in #88, I found that jupynium will call cells.line_types_entire_buf even without editing. That seems result in slow scroll in large files when jupynium is enabled.

@fecet fecet added the bug Something isn't working label Aug 10, 2023
@kiyoon
Copy link
Owner

kiyoon commented Aug 10, 2023

Does this happen with the PR or even without the PR? Maybe the function return table can be cached and reused if the buffer is not changed

@kiyoon
Copy link
Owner

kiyoon commented Aug 10, 2023

Is it because of the get_fold implementation in #88? Maybe ufo callback is being called too often?

@fecet
Copy link
Sponsor Contributor Author

fecet commented Aug 10, 2023

The problem persisted after I set dev=false so that's should be irrelevant with my PR.
Could you confirm this by something like

-- jupynium.nvim/lua/jupynium/highlighter.lua
function M.update()
  if not M.is_enabled() then
    return
  end

  local end_of_file = vim.fn.line "$"
  local line_types = cells.line_types_entire_buf()
  print("Call me")

Maybe the function return table can be cached and reused if the buffer is not changed

Yeah I agree this is a clever approach

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

Successfully merging a pull request may close this issue.

2 participants