mirror of
https://github.com/neovim/neovim.git
synced 2025-10-21 09:12:07 +00:00
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 }`.
This commit is contained in:

committed by
GitHub

parent
a4fc3bb0e6
commit
c5af5c0b9a
@@ -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([[
|
||||
|
Reference in New Issue
Block a user