Coder Social home page Coder Social logo

Comments (5)

azuenko avatar azuenko commented on June 1, 2024 1

Thank you Andy for fixing the issue. And generally thanks for developing and supporting this small yet quite useful plugin!

I can confirm the fix does its job, I've no more performance issues with the plugin.

from vim-gitgutter.

airblade avatar airblade commented on June 1, 2024

There's no performance problem for me which makes it difficult for me to determine when it is fixed.

Please could you profile gitgutter? This will show exactly where the slowdown is occurring.

I'm surprised, though, because 84bc2d6 simply replaced one built-in function – split() – with another – strridx() – and two array slices.

from vim-gitgutter.

azuenko avatar azuenko commented on June 1, 2024

Hello Andy,

Here are two profile logs, for the normal & slow versions. In both cases I opened nvim, then run 4x O<ESC>u on a file in git repo, and closed it. Hope that it helps!

gitgutter_profile_normal.log
gitgutter_profile_slow.log

from vim-gitgutter.

azuenko avatar azuenko commented on June 1, 2024

Some more info that could help you to debug the issue.

I put the debug statements

    call gitgutter#debug#log(base)
    call gitgutter#debug#log(bpath)

and here is what I get in the log:

Old version (before the fix)

  0.956426 function <SNR>74_on_exit_nvim[2]..gitgutter#diff#handler[1]:
  0.956426 @@ -255,0 +256,2 @@ function! gitgutter#utility#base_path(bufnr)^@@@ -256,0 +259 @@ function! gitgutter#utility#base_path(bufnr)

  1.484144 CursorHold Autocommands for "*"..function gitgutter#process_buffer[23]..gitgutter#diff#run_diff[55]..gitgutter#utility#base_path[7]:
  1.484144 

  1.485144 CursorHold Autocommands for "*"..function gitgutter#process_buffer[23]..gitgutter#diff#run_diff[55]..gitgutter#utility#base_path[8]:
  1.485144 autoload/gitgutter/utility.vim

New version (slow)

  0.959054 function <SNR>74_on_exit_nvim[2]..gitgutter#diff#handler[1]:
  0.959054 @@ -256,0 +257,3 @@ function! gitgutter#utility#base_path(bufnr)

  1.207955 CursorHold Autocommands for "*"..function gitgutter#process_buffer[23]..gitgutter#diff#run_diff[55]..gitgutter#utility#base_path[8]:
  1.207955 :autoload/gitgutter/utility.vim

  1.208686 CursorHold Autocommands for "*"..function gitgutter#process_buffer[23]..gitgutter#diff#run_diff[55]..gitgutter#utility#base_path[9]:
  1.208686 autoload/gitgutter/utility.vim

The notable difference is in base var, which is set to :autoload/gitgutter/utility.vim in the new (slow) version. I suspect the non-empty base triggers some additional code that causes slow down.

from vim-gitgutter.

airblade avatar airblade commented on June 1, 2024

Thanks for digging into that.

You're right: I was using substring indexes incorrectly which meant that base wasn't empty when it should have been, which was triggering additional code including a system() call.

I think I've got it right now...!

from vim-gitgutter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.