dhruvasagar / vim-zoom

Toggle zoom in / out individual windows (splits)
239 stars 15 forks source link

Performance issue when added to lualine #34

Closed crhf closed 1 year ago

crhf commented 1 year ago

After adding zoom#statusline() to lualine, cursor movement becomes laggy. Here's the profile:

FUNCTION  zoom#statusline()
    Defined: ~/.local/share/nvim/site/pack/packer/start/vim-zoom/autoload/zoom.vim:67
Called 1896 times
Total time:   0.231913
 Self time:   0.210157

count  total (s)   self (s)
 1896   0.220414   0.198658   if s:is_zoomed()
                                return get(g:, 'zoom#statustext', 'zoomed')
 1896              0.002003   endif
 1896              0.001847   return ''

FUNCTION  CursorHold_Cb()
    Defined: ~/.local/share/nvim/site/pack/packer/start/FixCursorHold.nvim/plugin/fix_cursorhold_nvim.vim:19
Called 91 times
Total time:   0.041464
 Self time:   0.009055

count  total (s)   self (s)
   91              0.002783   if v:exiting isnot v:null
                                return
   91              0.000249   endif
   91   0.003394   0.002906   set eventignore-=CursorHold
   91   0.032464   0.000873   doautocmd <nomodeline> CursorHold
   91   0.001247   0.000919   set eventignore+=CursorHold

FUNCTION  CursorHoldTimer()
    Defined: ~/.local/share/nvim/site/pack/packer/start/FixCursorHold.nvim/plugin/fix_cursorhold_nvim.vim:37
Called 901 times
Total time:   0.043519
 Self time:   0.043519

count  total (s)   self (s)
  901              0.016988   call timer_stop(g:fix_cursorhold_nvim_timer)
  901              0.007554   if mode() == 'n'
  901              0.013901     let g:fix_cursorhold_nvim_timer = timer_start(g:cursorhold_updatetime, 'CursorHold_Cb')
  901              0.001782   endif

FUNCTION  <SNR>102_is_zoomed()
    Defined: ~/.local/share/nvim/site/pack/packer/start/vim-zoom/autoload/zoom.vim:1
Called 1896 times
Total time:   0.021755
 Self time:   0.021755

count  total (s)   self (s)
 1896              0.019939   return get(t:, 'zoomed', 0)

FUNCTIONS SORTED ON TOTAL TIME
count  total (s)   self (s)  function
 1896   0.231913   0.210157  zoom#statusline()
  901   0.043519             CursorHoldTimer()
   91   0.041464   0.009055  CursorHold_Cb()
 1896   0.021755             <SNR>102_is_zoomed()

FUNCTIONS SORTED ON SELF TIME
count  total (s)   self (s)  function
 1896   0.231913   0.210157  zoom#statusline()
  901              0.043519  CursorHoldTimer()
 1896              0.021755  <SNR>102_is_zoomed()
   91   0.041464   0.009055  CursorHold_Cb()

The issue goes away if I remove vim-zoom from the status line.

dhruvasagar commented 1 year ago

@crhf What if you removed FixCursorHold.nvim ?

dhruvasagar commented 1 year ago

@crhf The plugin also mentions it is no longer needed. Do you have some custom cursorhold event setup ? vim-zoom does not do anything with any of the cursor events

dhruvasagar commented 1 year ago

@crhf Closing since there's no response, assuming it is no longer an issue.