-
Notifications
You must be signed in to change notification settings - Fork 17
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
cache location of session file #10
Conversation
Yeah, we're hitting the disk multiple times on when switching buffers. From your profiling it looks like +550 ms per buffer change, which is kind of excessive (maybe it's time to move to neovim for async). Was this tested on a spinning disk / network mount? Thanks for doing the leg work! One concern is if a user switches branches but keeps vim open, they'll unknowingly continue saving to the previous session. I'm not sure if this is desired behavior or not. Currently the user doesn't have to think about invalidating caches when switching git branches. If you still think this is worth pursuing, I have a few suggestions to make:
|
Thank you for taking time to review and provide such extensive feedback. My testing environment is local SSD which is almost full (no space for over-provisioning) and the reason to such a large delays is related to the size of git repository (linux kernel). I suggest to rewrite the session_file() function to return cached version if global variable is set. In case this variable is not set, the default behaviour will be performed. Regarding the session change per branch, it was the easiest approach to fix performance issues and it fits perfectly my flow. I am open for suggestions how to get information on branch change in order to update session file location. |
Rewriting The more I think about it, the more I prefer this behavior. I've accidentally overwritten the wrong session because I leave vim open. I just want to put this behind a feature toggle so we can test this for a bit before making it the default behavior if everything looks good. |
I agree with you, it is more convenient to user to save session once and The main concern is how to handle files which are available and open in one In any cases, i'll update the pull request in day or two. Thanks
|
I pushed new version of this feature. Thanks. |
Function session_file() returns the name of session file. This function is called for every change in VIM layout. Caching of return variable of this function gives x100 performance improvement. Before change: FUNCTIONS SORTED ON TOTAL TIME count total (s) self (s) function 6 3.369383 0.015592 g:GitSessionUpdate() 6 3.353791 0.000861 <SNR>35_session_file() 6 3.268404 0.001057 <SNR>35_session_dir() 12 3.263580 0.004735 <SNR>35_in_git_repo() After this change: FUNCTIONS SORTED ON TOTAL TIME count total (s) self (s) function 11 0.026195 g:GitSessionUpdate() 23 0.025646 <SNR>38_Highlight_Matching_Pair() 11 0.000956 nerdtree#checkForBrowse() VIM profiling (http://stackoverflow.com/a/12216578): :profile start profile.log :profile func * :profile file * " At this point do slow actions :profile pause :noautocmd qall! Signed-off-by: Leon Romanovsky <leon@leon.nu>
set cached to be disabled |
Add option to cache location of the session file, increasing performance 100x when working with large repositories.
Thanks for the patch and cleaning it up! Just a heads up, I've renamed the caching option name to |
I've updated docs here. Lemme know if it sounds weird or can be improved. |
Thank you.
" HELPER FUNCTIONS |
Yup, already added that in 9e444bc. |
Thanks |
FYI this is the new default behavior as of d4e8c65. |
Thank you, |
Function session_file() returns the name of session file.
This function is called for every change in VIM layout.
Caching of return variable of this function gives x100 performance
improvement.
Before change:
FUNCTIONS SORTED ON TOTAL TIME
count total (s) self (s) function
6 3.369383 0.015592 g:GitSessionUpdate()
6 3.353791 0.000861 35_session_file()
6 3.268404 0.001057 35_session_dir()
12 3.263580 0.004735 35_in_git_repo()
After this change:
FUNCTIONS SORTED ON TOTAL TIME
count total (s) self (s) function
11 0.026195 g:GitSessionUpdate()
23 0.025646 38_Highlight_Matching_Pair()
11 0.000956 nerdtree#checkForBrowse()
VIM profiling (http://stackoverflow.com/a/12216578):
:profile start profile.log
:profile func *
:profile file *
" At this point do slow actions
:profile pause
:noautocmd qall!
Signed-off-by: Leon Romanovsky leon@leon.nu