diff options
author | Evgeni Chasnovski <evgeni.chasnovski@gmail.com> | 2024-04-23 18:23:45 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-23 08:23:45 -0700 |
commit | c5af5c0b9ab84c86f84e32210512923e7eb641ba (patch) | |
tree | b27fe388402a7f4cb6d4b3f06377b8414438c1af /test/functional/lua/vim_spec.lua | |
parent | a4fc3bb0e68c8b078377fd9826e4cca3b4b3fdbf (diff) | |
download | rneovim-c5af5c0b9ab84c86f84e32210512923e7eb641ba.tar.gz rneovim-c5af5c0b9ab84c86f84e32210512923e7eb641ba.tar.bz2 rneovim-c5af5c0b9ab84c86f84e32210512923e7eb641ba.zip |
perf(lua): faster vim.deprecate() #28470
Problem: `vim.deprecate()` can be relatively significantly slower than
the deprecated function in "Nvim" plugin.
Solution: Optimize checks for "Nvim" plugin. This also results into not
distinguishing "xxx-dev" and "xxx" versions when doing checks, which
is essentially covered by the deprecation logic itself.
With this rewrite I get the times from #28459: `{ 0.024827, 0.003797, 0.002024, 0.001774, 0.001703 }`.
For quicker reference:
- On current Nightly it is something like `{ 3.72243, 0.918169, 0.968143, 0.763256, 0.783424 }`.
- On 0.9.5: `{ 0.002955, 0.000361, 0.000281, 0.000251, 0.00019 }`.
Diffstat (limited to 'test/functional/lua/vim_spec.lua')
-rw-r--r-- | test/functional/lua/vim_spec.lua | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua index 3b47d7a667..bb8b43caf7 100644 --- a/test/functional/lua/vim_spec.lua +++ b/test/functional/lua/vim_spec.lua @@ -147,8 +147,10 @@ describe('lua stdlib', function() end) it('when plugin = nil', function() + local cur = vim.version.parse(current_version) + local cur_to_compare = cur.major .. '.' .. cur.minor local was_removed = ( - vim.version.ge(current_version, '0.10') and 'was removed' or 'will be removed' + vim.version.ge(cur_to_compare, '0.10') and 'was removed' or 'will be removed' ) eq( dedent([[ |