-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add statusline generator benchmark
- Loading branch information
Showing
2 changed files
with
39 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
-- Feline statusline generation benchmark test | ||
-- Start Neovim with Feline installed and configured and source this file using the luafile command | ||
|
||
local opt = vim.opt | ||
local fn = vim.fn | ||
|
||
-- Automatically install plenary.nvim if it doesn't exist | ||
if not pcall(require, 'plenary.benchmark') then | ||
local install_path = '/tmp/nvim/site/pack/feline/start/plenary.nvim' | ||
|
||
opt.packpath:append('/tmp/nvim/site') | ||
|
||
if fn.isdirectory(install_path) == 0 then | ||
fn.system({'git', 'clone', 'https://github.com/nvim-lua/plenary.nvim', install_path}) | ||
end | ||
end | ||
|
||
-- Start benchmark | ||
local benchmark = require('plenary.benchmark') | ||
local statusline_generator = require('feline').statusline | ||
|
||
benchmark("Feline statusline generation benchmark", { | ||
runs = 1000, | ||
fun = { | ||
{ | ||
"Generating statusline", | ||
statusline_generator | ||
} | ||
} | ||
}) | ||
|