aboutsummaryrefslogtreecommitdiff
path: root/test/benchmark
diff options
context:
space:
mode:
Diffstat (limited to 'test/benchmark')
-rw-r--r--test/benchmark/autocmd_spec.lua56
-rw-r--r--test/benchmark/bench_regexp_spec.lua3
-rw-r--r--test/benchmark/treesitter_spec.lua7
3 files changed, 43 insertions, 23 deletions
diff --git a/test/benchmark/autocmd_spec.lua b/test/benchmark/autocmd_spec.lua
index cd1af23640..b3421d86eb 100644
--- a/test/benchmark/autocmd_spec.lua
+++ b/test/benchmark/autocmd_spec.lua
@@ -27,7 +27,8 @@ describe('autocmd perf', function()
end)
it('nvim_create_autocmd, nvim_del_autocmd (same pattern)', function()
- exec_lua([[
+ exec_lua(
+ [[
local N = ...
local ids = {}
@@ -45,11 +46,14 @@ describe('autocmd perf', function()
vim.api.nvim_del_autocmd(ids[i])
end
stop('nvim_del_autocmd')
- ]], N)
+ ]],
+ N
+ )
end)
it('nvim_create_autocmd, nvim_del_autocmd (unique patterns)', function()
- exec_lua([[
+ exec_lua(
+ [[
local N = ...
local ids = {}
@@ -67,11 +71,14 @@ describe('autocmd perf', function()
vim.api.nvim_del_autocmd(ids[i])
end
stop('nvim_del_autocmd')
- ]], N)
+ ]],
+ N
+ )
end)
it('nvim_create_autocmd + nvim_del_autocmd', function()
- exec_lua([[
+ exec_lua(
+ [[
local N = ...
start()
@@ -83,11 +90,14 @@ describe('autocmd perf', function()
vim.api.nvim_del_autocmd(id)
end
stop('nvim_create_autocmd + nvim_del_autocmd')
- ]], N)
+ ]],
+ N
+ )
end)
it('nvim_exec_autocmds (same pattern)', function()
- exec_lua([[
+ exec_lua(
+ [[
local N = ...
for i = 1, N do
@@ -100,11 +110,14 @@ describe('autocmd perf', function()
start()
vim.api.nvim_exec_autocmds('User', { pattern = 'Benchmark', modeline = false })
stop('nvim_exec_autocmds')
- ]], N)
+ ]],
+ N
+ )
end)
it('nvim_del_augroup_by_id', function()
- exec_lua([[
+ exec_lua(
+ [[
local N = ...
local group = vim.api.nvim_create_augroup('Benchmark', {})
@@ -119,11 +132,14 @@ describe('autocmd perf', function()
start()
vim.api.nvim_del_augroup_by_id(group)
stop('nvim_del_augroup_by_id')
- ]], N)
+ ]],
+ N
+ )
end)
it('nvim_del_augroup_by_name', function()
- exec_lua([[
+ exec_lua(
+ [[
local N = ...
local group = vim.api.nvim_create_augroup('Benchmark', {})
@@ -138,11 +154,14 @@ describe('autocmd perf', function()
start()
vim.api.nvim_del_augroup_by_name('Benchmark')
stop('nvim_del_augroup_by_id')
- ]], N)
+ ]],
+ N
+ )
end)
it(':autocmd, :autocmd! (same pattern)', function()
- exec_lua([[
+ exec_lua(
+ [[
local N = ...
start()
@@ -154,11 +173,14 @@ describe('autocmd perf', function()
start()
vim.cmd('autocmd! User Benchmark')
stop(':autocmd!')
- ]], N)
+ ]],
+ N
+ )
end)
it(':autocmd, :autocmd! (unique patterns)', function()
- exec_lua([[
+ exec_lua(
+ [[
local N = ...
start()
@@ -170,6 +192,8 @@ describe('autocmd perf', function()
start()
vim.cmd('autocmd! User')
stop(':autocmd!')
- ]], N)
+ ]],
+ N
+ )
end)
end)
diff --git a/test/benchmark/bench_regexp_spec.lua b/test/benchmark/bench_regexp_spec.lua
index 6128549f0f..4a7c50557b 100644
--- a/test/benchmark/bench_regexp_spec.lua
+++ b/test/benchmark/bench_regexp_spec.lua
@@ -10,8 +10,7 @@ local result_file = 'benchmark.out'
local sample_file = 'test/old/testdir/samples/re.freeze.txt'
-- Vim script code that does both the work and the benchmarking of that work.
-local measure_cmd =
- [[call Measure(%d, ']] .. sample_file .. [[', '\s\+\%%#\@<!$', '+5')]]
+local measure_cmd = [[call Measure(%d, ']] .. sample_file .. [[', '\s\+\%%#\@<!$', '+5')]]
local measure_script = [[
func Measure(re, file, pattern, arg)
let sstart = reltime()
diff --git a/test/benchmark/treesitter_spec.lua b/test/benchmark/treesitter_spec.lua
index 6d82f5de8d..7c9906a7b2 100644
--- a/test/benchmark/treesitter_spec.lua
+++ b/test/benchmark/treesitter_spec.lua
@@ -4,14 +4,13 @@ local clear = helpers.clear
local exec_lua = helpers.exec_lua
describe('treesitter perf', function()
-
setup(function()
clear()
end)
it('can handle large folds', function()
- helpers.command'edit ./src/nvim/eval.c'
- exec_lua[[
+ helpers.command 'edit ./src/nvim/eval.c'
+ exec_lua [[
local parser = vim.treesitter.get_parser(0, "c", {})
vim.treesitter.highlighter.new(parser)
@@ -47,7 +46,5 @@ describe('treesitter perf', function()
return vim.uv.hrtime() - start
]]
-
end)
-
end)