aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2024-02-08 14:55:09 +0000
committerLewis Russell <lewis6991@gmail.com>2024-02-08 14:55:09 +0000
commit2f6d5588f3a8535601678c576ee9816fce69abeb (patch)
tree097b0a018baa68e8082c6e6491cf05c6453421df
parentb0bff57a3bc79481d89595791e3fb0e4dd10c896 (diff)
downloadrneovim-2f6d5588f3a8535601678c576ee9816fce69abeb.tar.gz
rneovim-2f6d5588f3a8535601678c576ee9816fce69abeb.tar.bz2
rneovim-2f6d5588f3a8535601678c576ee9816fce69abeb.zip
Revert "fixup! add benchmark"
This reverts commit b0bff57a3bc79481d89595791e3fb0e4dd10c896.
-rw-r--r--test/benchmark/treesitter_spec.lua67
1 files changed, 0 insertions, 67 deletions
diff --git a/test/benchmark/treesitter_spec.lua b/test/benchmark/treesitter_spec.lua
index bf382ca591..7c9906a7b2 100644
--- a/test/benchmark/treesitter_spec.lua
+++ b/test/benchmark/treesitter_spec.lua
@@ -3,8 +3,6 @@ local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local exec_lua = helpers.exec_lua
-local big_linux_file_url = 'https://raw.githubusercontent.com/torvalds/linux/master/drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_2_0_sh_mask.h'
-
describe('treesitter perf', function()
setup(function()
clear()
@@ -49,69 +47,4 @@ describe('treesitter perf', function()
return vim.uv.hrtime() - start
]]
end)
-
- -- takes around 2 minutes
- it('iter_matches', function()
- local filename = vim.fs.basename(big_linux_file_url)
-
- if not vim.uv.fs_stat(filename) then
- helpers.repeated_read_cmd('wget', big_linux_file_url)
- end
- helpers.command('edit '..filename)
-
- --- @param samples integer[]
- --- @param matches integer
- local function compute(samples, matches)
- local sum = 0
- local sumsq = 0
- local min = math.huge
- local max = 0
- local n = #samples
- for i = 1, n do
- local sample = samples[i]
- sum = sum + sample
- sumsq = sumsq + (sample * sample)
- if sample > max then
- max = sample
- end
- if sample < min then
- min = sample
- end
- end
-
- local mean = sum / n
- local sqsum = sum * sum
- local std = math.sqrt((sumsq - (sqsum / n)) / (n - 1))
-
- return string.format('N=%d, matches=%d mean=%f, std=%f, min=%f, max=%f', n, matches/n, mean, std, min, max)
- end
-
- local result = exec_lua[[
- local tree = vim.treesitter.get_parser(0, 'c', {})
- local query = vim.treesitter.query.get('c', 'highlights')
- tree:parse(true)
-
- local samples = {} --- @type integer[]
- local matches = 0
-
- for i = 1, 10 do
- local start = vim.uv.hrtime()
-
- tree:for_each_tree(function(tstree)
- local root = tstree:root()
- for _ in query:iter_matches(root, 0) do
- matches = matches + 1
- end
- end)
-
- local elapsed = vim.uv.hrtime() - start
- samples[i] = elapsed / 1000000
- end
-
- return {samples, matches}
- ]]
-
- print(compute(result[1], result[2]))
- end)
-
end)