Open theahura opened 1 year ago
Interesting! I notice for 2 FormatBuffer calls there it has 3 syscall#Call ones, but still I believe the 2.6s is total cumulative time for all calls, so it doesn't explain the discrepancy. Off the top of my head, the sequence of events is just the syscall plus writing to the buffer, so I don't have any clear hypothesis where the time could be going… maybe python delays since we use python if available for nicer in-place patching of diff chunks?
Few ideas to try:
:syntax off
first affects performance anymaktaba#buffer#Overwrite
?) it'd be interesting to check performance on.FWIW, I also have a vision for codefmt where it works more in the background to detect suggesting formatting changes and queue them up, then just applies those on save (invalidating and rerunning formatter if there were any conflicting edits in between). That would really help ameliorate performance for cases where the formatter tool itself just refuses to give reasonable performance + people want format-on-save. But that's a side thought, this issue sounds acute and hopefully something with an easier quick fix.
thanks for the quick response!
syntax off
seemed to make it much slower!K thanks! Don't worry too much about the other steps… those were more suggestions to plugin devs as we're digging into troubleshooting (unless you're really itching to do some deeper troubleshooting yourself… LMK and I can clarify).
cant say that I am :sweat_smile: im more in the camp of 'id love if these tools just worked out of the box without that much config'
Hey @dbarnett just checking to see if there was any movement on this one -- definitely still noticing a fair bit of slowness!
Nope, I don't have vim 9.0 handy and wasn't able to easily repro performance problems from a few things I tried. I did find vim 9 without working python support didn't seem to have any performance problems.
If you want to locally edit this line https://github.com/google/vim-maktaba/blob/fe95bb10f6bb250943a44632107f6a3d76ce5f28/autoload/maktaba/buffer.vim#L84 to temporarily replace if has('python3') || has('python')
with if 0
it might help.
Describe the bug Recently upgraded vim, and I noticed that vim basically froze every time I wrote a file. I opened a typescript file with about 200loc and profiled using this set of commands: https://stackoverflow.com/a/12216578/3269537 To profile I just opened the file and saved it, then closed the file.
Output:
notice that maktaba takes ~5s and codefmt takes ~2.5
To Reproduce Minimal vimrc:
Expected behavior Previously this was not nearly this slow. I was expecting a non-noticeable latency on save.
OS (version) Ubuntu 20.04.3 LTS
Additional context vim version: VIM - Vi IMproved 9.0 (2022 Jun 28, compiled May 10 2022 08:40:37)