git-time-metric / gtm-vim-plugin

Plugin for the Vim editor to be used with the Git Time Metric platform.
MIT License
59 stars 4 forks source link

Seems like the `record` function is pretty slow in MacVim 8.0.596 #4

Open martisj opened 7 years ago

martisj commented 7 years ago

I guess this is not really an issue, more a improvement request :)

Running a profile with

:profile start profile.log
:profile func *
:profile file *
" and then switch between split panes (the slow action)
:profile pause

Shows this in the profile.log

FUNCTION  <SNR>49_record()
Called 1 time
Total time:   1.154513
 Self time:   0.000265

count  total (s)   self (s)
    1              0.000043   let fpath = expand('%:p')
                              " record if file path has changed or last update is greater than update_interval
    1              0.000004   if s:last_file != fpath || localtime() - s:last_update > s:update_interval
    1              0.000003     let s:cmd = (g:gtm_plugin_status_enabled == 1 ? 'gtm record --status' : 'gtm record')
    1   1.154413   0.000165     let output=system(s:cmd . ' ' . shellescape(fpath))
    1              0.000008     if v:shell_error
                                  echoerr s:no_gtm_err
                                else
    1              0.000011       let s:gtm_plugin_status = (g:gtm_plugin_status_enabled ? substitute(output, '\n\+$', '', '') : '')
    1              0.000001     endif
    1              0.000005     let s:last_update = localtime()
    1              0.000004     let s:last_file = fpath
    1              0.000000   endif

1.15 seconds is quite a long time to wait. Is there anything that can be done here? Running in iTerm on mac with NeoVim, there is almost no lag.

mschenk42 commented 7 years ago

I'm guessing MacVim has a slow implementation of running external shell commands. I tested it with Vim 8 and the results are pretty good. It my understanding MacVim is port of Vim and should be close in performance?

3 0.082365 0.000741 let output=system(s:cmd . ' ' . shellescape(fpath))

However I wonder if the problem is gtm being slow to run the record command. Performance of gtm can vary depending on the git repo. Did you test with the same git repo with Neovim?