Update generated neovim config
This commit is contained in:
1
config/neovim/store/lazy-plugins/mini.nvim/benchmarks/starter/.gitignore
vendored
Normal file
1
config/neovim/store/lazy-plugins/mini.nvim/benchmarks/starter/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
startup-times.csv
|
||||
@ -0,0 +1,35 @@
|
||||
# Benchmarks for 'mini.starter'
|
||||
|
||||
This directory contains code and results of benchmarking 'mini.starter' and its alternatives. Target benchmarked value is a total startup time using configuration file (with `-u <init-file>`) corresponding to benchmarked setup. Configuration files are created in three different groups:
|
||||
|
||||
- 'init_starter-default.lua' and 'init_empty.lua' represent default 'mini.starter' setup and corresponding 'init.lua' without 'mini.starter'.
|
||||
- 'init_startify-starter', 'init_startify-original', and 'init_startify-alpha' have comparable output imitating default 'vim-startify' with empty header.
|
||||
- 'init_dashboard-starter', 'init_dashboard-original', and 'init_dashboard-alpha' have comparable output imitating default 'dashboard-nvim' enabled keybindings.
|
||||
|
||||
Summary of startup-times for various 'init' files from 'init-files/' directory can be seen in 'startup-summary.md'. Current benchmark was done with Neovim 0.5.1 on Ubuntu 18.04 (i3-6100). Exact states of plugins used:
|
||||
|
||||
- [echasnovski/mini.nvim](https://github.com/echasnovski/mini.nvim/tree/cfa108eeaead1abd8854a1f1cfb02e72482641ce)
|
||||
- [mhinz/vim-startify](https://github.com/mhinz/vim-startify/tree/81e36c352a8deea54df5ec1e2f4348685569bed2)
|
||||
- [glepnir/dashboard-nvim](https://github.com/glepnir/dashboard-nvim/tree/ba98ab86487b8eda3b0934b5423759944b5f7ebd)
|
||||
- [goolord/alpha-nvim](https://github.com/goolord/alpha-nvim/tree/7a49086bf9197f573b396d4ac46262c02dfb9aec)
|
||||
|
||||
To rerun locally execute these commands (preferably without anything else running in the background and monitor always on):
|
||||
|
||||
```bash
|
||||
chmod +x install.sh
|
||||
./install.sh
|
||||
|
||||
# This will create file 'startup-times.csv' and update 'startup-summary.md'
|
||||
# WARNING: this will lead to screen flicker
|
||||
chmod +x benchmark.sh
|
||||
./benchmark.sh
|
||||
```
|
||||
|
||||
Structure:
|
||||
|
||||
- 'init-files/' - directory with all configuration files being benchmarked. NOTE: all of them contain auto-closing command at the end (`defer_fn(...)`) to most accurately measure startup time. To view its output, remove this command.
|
||||
- 'benchmark.sh' - script for performing benchmark which is as close to real-world usage as reasonably possible and computing its summary. Its outputs are 'startup-times.csv' and 'startup-summary.md'. All configuration files are benchmarked in alternate fashion: first 'init' file, second, ..., last, first, etc. WARNING: EXECUTION OF THIS SCRIPT LEADS TO MONITOR FLICKERING WHICH MAY CAUSE HARM TO YOUR HEALTH. This is needed to ensure that Neovim was actually opened and something was drawn.
|
||||
- 'install.sh' - script for installing all required plugins. NOTE: run `chmod +x install.sh` to make it executable.
|
||||
- 'make_summary.py' - Python script to compute summary statistics of csv-file.
|
||||
- 'startup-times.csv' (ignored by Git, latest one can be seen in [this gist](https://gist.github.com/echasnovski/85c334396df6fd0cea7bb42246efb97b)) - csv-file with measured startup times. Each row represent single startup round: when all 'init' files are run alternately. Each column represents startup times of single 'init' file.
|
||||
- 'startup-summary.md' - markdown file as output of 'make_summary.py'. Contains summaries of 'startup-times.csv'.
|
||||
56
config/neovim/store/lazy-plugins/mini.nvim/benchmarks/starter/benchmark.sh
Executable file
56
config/neovim/store/lazy-plugins/mini.nvim/benchmarks/starter/benchmark.sh
Executable file
@ -0,0 +1,56 @@
|
||||
#!/nix/store/4bj2kxdm1462fzcc2i2s4dn33g2angcc-bash-5.2p32/bin/bash
|
||||
|
||||
# Perform benchmarking of startup times with different Neovim 'init' files.
|
||||
# Execute `nvim -u <*> --startuptime <*>` several times (as closely to actual
|
||||
# usage as possible) in rounds alternating between input 'init' files (to "mix"
|
||||
# possible random noise). Store output in .csv file with rows containing
|
||||
# startup times for a single round, columns - for a single 'init' file.
|
||||
|
||||
# WARNING: EXECUTION OF THIS SCRIPT LEADS TO FLICKERING OF SCREEN WHICH WHICH
|
||||
# MAY CAUSE HARM TO YOUR HEALTH. This is because every 'init' file leads to an
|
||||
# actual opening of Neovim with later automatic closing.
|
||||
|
||||
# Number of rounds to perform benchmark
|
||||
n_rounds=1000
|
||||
|
||||
# Path to output .csv file with startup times per round
|
||||
csv_file=startup-times.csv
|
||||
|
||||
# Path to output .md file with summary table
|
||||
summary_file=startup-summary.md
|
||||
|
||||
# 'Init' files ids with actual paths computed as 'init-files/init_*.lua'
|
||||
init_files=(starter-default empty startify-starter startify-original startify-alpha dashboard-starter dashboard-original dashboard-alpha)
|
||||
|
||||
function comma_join { local IFS=","; shift; echo "$*"; }
|
||||
|
||||
function benchmark {
|
||||
rm -f "$csv_file"
|
||||
touch "$csv_file"
|
||||
|
||||
local tmp_bench_file="tmp-bench.txt"
|
||||
touch "$tmp_bench_file"
|
||||
|
||||
comma_join -- "$@" >> startup-times.csv
|
||||
|
||||
for i in $(seq 1 $n_rounds); do
|
||||
echo "Round $i"
|
||||
|
||||
local bench_times=()
|
||||
|
||||
for init_file in "$@"; do
|
||||
nvim -u "init-files/init_$init_file.lua" --startuptime "$tmp_bench_file"
|
||||
local b_time=$(tail -n 1 "$tmp_bench_file" | cut -d " " -f1)
|
||||
bench_times=("${bench_times[@]}" "$b_time")
|
||||
done
|
||||
|
||||
comma_join -- "${bench_times[@]}" >> "$csv_file"
|
||||
|
||||
rm "$tmp_bench_file"
|
||||
done
|
||||
}
|
||||
|
||||
benchmark "${init_files[@]}"
|
||||
|
||||
# Produce output summary
|
||||
./make_summary.py "${csv_file}" "${summary_file}"
|
||||
@ -0,0 +1,21 @@
|
||||
vim.cmd([[set packpath=/tmp/nvim/site]])
|
||||
vim.cmd([[packadd alpha-nvim]])
|
||||
|
||||
local alpha = require('alpha')
|
||||
local dashboard = require('alpha.themes.dashboard')
|
||||
alpha.setup(dashboard.opts)
|
||||
|
||||
vim.g.mapleader = ' '
|
||||
|
||||
-- Some of these keybindings doesn't exactly match with what is shown in
|
||||
-- buffer, but this doesn't really matter. Main point is that some keybindings
|
||||
-- should be pre-made.
|
||||
vim.api.nvim_set_keymap('n', '<Leader>ff', ':Telescope find_files<CR>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<Leader>fh', ':Telescope oldfiles<CR>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<Leader>fr', ':Telescope jumplist<CR>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<Leader>fg', ':Telescope live_grep<CR>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<Leader>fm', ':Telescope marks<CR>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<Leader>sl', ':Telescope command_history<CR>', { noremap = true, silent = true })
|
||||
|
||||
-- Close Neovim just after fully opening it. Randomize to make "more real".
|
||||
vim.defer_fn(function() vim.cmd([[quit]]) end, 100 + 200 * math.random())
|
||||
@ -0,0 +1,17 @@
|
||||
vim.cmd([[set packpath=/tmp/nvim/site]])
|
||||
vim.cmd([[packadd dashboard-nvim]])
|
||||
|
||||
vim.g.mapleader = ' '
|
||||
vim.g.dashboard_default_executive = 'telescope'
|
||||
vim.api.nvim_set_keymap('n', '<Leader>ss', ':<C-u>SessionSave<CR>', {})
|
||||
vim.api.nvim_set_keymap('n', '<Leader>sl', ':<C-u>SessionLoad<CR>', {})
|
||||
|
||||
vim.api.nvim_set_keymap('n', '<Leader>fh', ':DashboardFindHistory<CR>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<Leader>ff', ':DashboardFindFile<CR>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<Leader>tc', ':DashboardChangeColorscheme<CR>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<Leader>fa', ':DashboardFindWord<CR>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<Leader>fb', ':DashboardJumpMark<CR>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<Leader>cn', ':DashboardNewFile<CR>', { noremap = true, silent = true })
|
||||
|
||||
-- Close Neovim just after fully opening it. Randomize to make "more real".
|
||||
vim.defer_fn(function() vim.cmd([[quit]]) end, 100 + 200 * math.random())
|
||||
@ -0,0 +1,18 @@
|
||||
vim.cmd([[set packpath=/tmp/nvim/site]])
|
||||
vim.cmd([[packadd mini.nvim]])
|
||||
|
||||
local starter = require('mini.starter')
|
||||
starter.setup({
|
||||
items = {
|
||||
{ name = 'Edit file', action = [[enew]], section = 'Actions' },
|
||||
{ name = 'Quit', action = [[quit]], section = 'Actions' },
|
||||
starter.sections.telescope(),
|
||||
},
|
||||
content_hooks = {
|
||||
starter.gen_hook.adding_bullet(),
|
||||
starter.gen_hook.aligning('center', 'center'),
|
||||
},
|
||||
})
|
||||
|
||||
-- Close Neovim just after fully opening it. Randomize to make "more real".
|
||||
vim.defer_fn(function() vim.cmd([[quit]]) end, 100 + 200 * math.random())
|
||||
@ -0,0 +1,4 @@
|
||||
vim.cmd([[set packpath=/tmp/nvim/site]])
|
||||
|
||||
-- Close Neovim just after fully opening it. Randomize to make "more real".
|
||||
vim.defer_fn(function() vim.cmd([[quit]]) end, 100 + 200 * math.random())
|
||||
@ -0,0 +1,7 @@
|
||||
vim.cmd([[set packpath=/tmp/nvim/site]])
|
||||
vim.cmd([[packadd mini.nvim]])
|
||||
|
||||
require('mini.starter').setup()
|
||||
|
||||
-- Close Neovim just after fully opening it. Randomize to make "more real".
|
||||
vim.defer_fn(function() vim.cmd([[quit]]) end, 100 + 200 * math.random())
|
||||
@ -0,0 +1,10 @@
|
||||
vim.cmd([[set packpath=/tmp/nvim/site]])
|
||||
vim.cmd([[packadd alpha-nvim]])
|
||||
|
||||
local alpha = require('alpha')
|
||||
local startify = require('alpha.themes.startify')
|
||||
startify.nvim_web_devicons.enabled = false
|
||||
alpha.setup(startify.opts)
|
||||
|
||||
-- Close Neovim just after fully opening it. Randomize to make "more real".
|
||||
vim.defer_fn(function() vim.cmd([[quit]]) end, 100 + 200 * math.random())
|
||||
@ -0,0 +1,7 @@
|
||||
vim.cmd([[set packpath=/tmp/nvim/site]])
|
||||
vim.cmd([[packadd vim-startify]])
|
||||
|
||||
vim.g.startify_custom_header = ''
|
||||
|
||||
-- Close Neovim just after fully opening it. Randomize to make "more real".
|
||||
vim.defer_fn(function() vim.cmd([[quit]]) end, 100 + 200 * math.random())
|
||||
@ -0,0 +1,20 @@
|
||||
vim.cmd([[set packpath=/tmp/nvim/site]])
|
||||
vim.cmd([[packadd mini.nvim]])
|
||||
|
||||
local starter = require('mini.starter')
|
||||
starter.setup({
|
||||
evaluate_single = true,
|
||||
items = {
|
||||
starter.sections.builtin_actions(),
|
||||
starter.sections.recent_files(10, false),
|
||||
starter.sections.recent_files(10, true),
|
||||
},
|
||||
content_hooks = {
|
||||
starter.gen_hook.adding_bullet(),
|
||||
starter.gen_hook.indexing('all', { 'Builtin actions' }),
|
||||
starter.gen_hook.padding(3, 2),
|
||||
},
|
||||
})
|
||||
|
||||
-- Close Neovim just after fully opening it. Randomize to make "more real".
|
||||
vim.defer_fn(function() vim.cmd([[quit]]) end, 100 + 200 * math.random())
|
||||
10
config/neovim/store/lazy-plugins/mini.nvim/benchmarks/starter/install.sh
Executable file
10
config/neovim/store/lazy-plugins/mini.nvim/benchmarks/starter/install.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/nix/store/4bj2kxdm1462fzcc2i2s4dn33g2angcc-bash-5.2p32/bin/bash
|
||||
PLUGINPATH=/tmp/nvim/site/pack/bench/opt
|
||||
rm -rf $PLUGINPATH
|
||||
mkdir -p $PLUGINPATH
|
||||
cd $PLUGINPATH
|
||||
|
||||
git clone --depth 1 https://github.com/echasnovski/mini.nvim
|
||||
git clone --depth 1 https://github.com/goolord/alpha-nvim
|
||||
git clone --depth 1 https://github.com/glepnir/dashboard-nvim
|
||||
git clone --depth 1 https://github.com/mhinz/vim-startify
|
||||
@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env python
|
||||
import argparse
|
||||
import csv
|
||||
import statistics
|
||||
|
||||
|
||||
def read_csv_columns(csv_path):
|
||||
with open(csv_path, "r") as csvfile:
|
||||
reader = csv.DictReader(csvfile)
|
||||
res = {h: [] for h in reader.fieldnames}
|
||||
for line_dict in reader:
|
||||
for h, val in line_dict.items():
|
||||
res[h].append(float(val))
|
||||
|
||||
return res
|
||||
|
||||
|
||||
def summarise_array(x):
|
||||
return {
|
||||
"median": statistics.median(x),
|
||||
"mean": statistics.mean(x),
|
||||
"stdev": statistics.stdev(x),
|
||||
"minimum": min(x),
|
||||
"maximum": max(x),
|
||||
}
|
||||
|
||||
|
||||
def save_md_summary(summary, output_path):
|
||||
lines = []
|
||||
|
||||
row_names = list(summary.keys())
|
||||
col_names = ["init file"] + list(summary[row_names[0]].keys())
|
||||
lines.append(" | ".join(col_names))
|
||||
lines.append(" | ".join("---" for _ in col_names))
|
||||
|
||||
for row_n in row_names:
|
||||
l = [row_n] + [str(round(x, 1)) + 'ms' for x in summary[row_n].values()]
|
||||
lines.append(" | ".join(l))
|
||||
|
||||
lines = ["| " + l + " |\n" for l in lines]
|
||||
|
||||
with open(output_path, "w") as output:
|
||||
for l in lines:
|
||||
output.write(l)
|
||||
|
||||
|
||||
def compute_summary(csv_path):
|
||||
columns = read_csv_columns(csv_path)
|
||||
return {h: summarise_array(x) for h, x in columns.items()}
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"input_csv", help="path to file with startup times in csv format", type=str
|
||||
)
|
||||
parser.add_argument(
|
||||
"output_md",
|
||||
help="output path where markdown summary table will be written",
|
||||
type=str,
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
save_md_summary(compute_summary(args.input_csv), args.output_md)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@ -0,0 +1,10 @@
|
||||
| init file | median | mean | stdev | minimum | maximum |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| starter-default | 69.0ms | 70.8ms | 4.3ms | 63.6ms | 82.7ms |
|
||||
| empty | 64.1ms | 65.8ms | 4.3ms | 60.0ms | 79.4ms |
|
||||
| startify-starter | 70.2ms | 71.9ms | 4.5ms | 64.3ms | 85.7ms |
|
||||
| startify-original | 80.3ms | 82.2ms | 4.5ms | 76.4ms | 107.2ms |
|
||||
| startify-alpha | 72.1ms | 73.8ms | 4.3ms | 66.5ms | 86.9ms |
|
||||
| dashboard-starter | 68.4ms | 70.3ms | 4.5ms | 63.3ms | 102.9ms |
|
||||
| dashboard-original | 70.6ms | 72.3ms | 4.4ms | 65.5ms | 99.6ms |
|
||||
| dashboard-alpha | 69.8ms | 71.5ms | 4.4ms | 64.7ms | 97.2ms |
|
||||
Reference in New Issue
Block a user