mirror of
https://github.com/NixOS/nix.git
synced 2025-11-19 16:59:35 +01:00
[TMP]: Add some benchmarking tools
Not intended to be merged (at least definitely not as it is)
This commit is contained in:
parent
bb06640971
commit
891390d76f
3 changed files with 71 additions and 1 deletions
51
benchmark.sh
Executable file
51
benchmark.sh
Executable file
|
|
@ -0,0 +1,51 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -euo pipefail
|
||||
set -x
|
||||
|
||||
callNix () {
|
||||
nix \
|
||||
--experimental-features "nix-command flakes" \
|
||||
--store /tmp/nix \
|
||||
"$@"
|
||||
}
|
||||
|
||||
callBuild () {
|
||||
callNix \
|
||||
eval --impure --file "$THINGTOBENCH" drvPath \
|
||||
"$@"
|
||||
}
|
||||
getCompletions () {
|
||||
NIX_GET_COMPLETIONS=6 callNix build "github:NixOS/nixpkgs?rev=ad0d20345219790533ebe06571f82ed6b034db31#firef" "$@"
|
||||
}
|
||||
runSearch () {
|
||||
callNix search "github:NixOS/nixpkgs?rev=ad0d20345219790533ebe06571f82ed6b034db31" firefox "$@"
|
||||
}
|
||||
|
||||
noCache () {
|
||||
"$@" --option eval-cache false
|
||||
}
|
||||
coldCache () {
|
||||
if [[ -e ~/.cache/nix/eval-cache-v2 || -e ~/.cache/nix/eval-cache-v3 ]]; then
|
||||
echo "Error: The cache should be clean"
|
||||
exit 1
|
||||
fi
|
||||
"$@"
|
||||
}
|
||||
|
||||
run_all () {
|
||||
|
||||
mkdir -p "$out"
|
||||
|
||||
NIX_SHOW_STATS=1 NIX_SHOW_STATS_PATH=$out/eval-stats.json bash $0 noCache callBuild
|
||||
|
||||
hyperfine \
|
||||
--warmup 2 \
|
||||
--export-csv "$out/result.csv" \
|
||||
--export-json "$out/result.json" \
|
||||
--export-markdown "$out/result.md" \
|
||||
--style basic \
|
||||
--prepare '' "bash $0 noCache callBuild"
|
||||
}
|
||||
|
||||
"$@"
|
||||
Loading…
Add table
Add a link
Reference in a new issue