test: add harness for measuring performance

This commit is contained in:
Steven Arcangeli 2024-11-14 19:18:18 -08:00
parent 0472d9296a
commit 7d4e62942f
4 changed files with 143 additions and 1 deletions

View file

@ -35,6 +35,23 @@ fastlint: scripts/nvim_doc_tools venv
luacheck lua tests --formatter plain
stylua --check lua tests
## profile: use LuaJIT profiler to profile the plugin
.PHONY: profile
profile:
nvim --clean -u tests/perf_harness.lua -c 'lua jit_profile()'
## flame_profile: create a trace in the chrome profiler format
.PHONY: flame_profile
flame_profile:
nvim --clean -u tests/perf_harness.lua -c 'lua flame_profile()'
@echo "Visit https://ui.perfetto.dev/ and load the profile.json file"
## benchmark: benchmark performance opening directory with many files
.PHONY: benchmark
benchmark:
nvim --clean -u tests/perf_harness.lua -c 'lua benchmark(10)'
@cat tests/perf/benchmark.txt
scripts/nvim_doc_tools:
git clone https://github.com/stevearc/nvim_doc_tools scripts/nvim_doc_tools
@ -44,4 +61,4 @@ scripts/nvim-typecheck-action:
## clean: reset the repository to a clean state
.PHONY: clean
clean:
rm -rf scripts/nvim_doc_tools scripts/nvim-typecheck-action venv .testenv
rm -rf scripts/nvim_doc_tools scripts/nvim-typecheck-action venv .testenv tests/perf profile.json