kiyoon / jupynium.nvim

Selenium-automated Jupyter Notebook that is synchronised with NeoVim in real-time.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Refresh line_types cause performance degradation(probably)

fecet opened this issue · comments

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.

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

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

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