diff options
author | Lewis Russell <lewis6991@gmail.com> | 2022-07-27 23:35:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-27 23:35:01 +0100 |
commit | d27e4d657bf2c3181326f8c564c8684e80442100 (patch) | |
tree | b27c826841017899c8b13ddf80d2833aa229e335 /runtime/lua/vim/ui.lua | |
parent | 48608a1f46abfba130faa96d59bdf4b8283fe0ac (diff) | |
download | rneovim-d27e4d657bf2c3181326f8c564c8684e80442100.tar.gz rneovim-d27e4d657bf2c3181326f8c564c8684e80442100.tar.bz2 rneovim-d27e4d657bf2c3181326f8c564c8684e80442100.zip |
perf(api): optimize nvim_cmd (#19513)
Reduce the amount of string allocations and length calculations.
With the following benchmark:
```lua
total = 0
for _ = 1, loops do
local start = now()
vim.api.nvim_cmd({cmd = 'let', args = {'a', '=', '1'}}, {})
total = total + (now() - start)
end
print('nvim_cmd', total / loops)
```
```
hyperfine 'nvim --clean test.lua +source +q'
```
Before: 234.5ms
After: 173.8ms
Diffstat (limited to 'runtime/lua/vim/ui.lua')
0 files changed, 0 insertions, 0 deletions