-
Notifications
You must be signed in to change notification settings - Fork 107
Description
We are experiencing moderate to high performance regressions since upgrading to > 1.10.0. Our Nickel code base is relatively big and we see eval times increasing anywhere from 1-10x against the 1.9.1 Nickel version and this starts to impact productivity and developer experience. The eval times increased from ~ 100-300ms to 1-3secs depending on the eval target. I'm more than happy to look into this in more detail to identify root cause areas but decided to raise this issue as first step.
System
I am on a Apple M3 Pro running macOS 15.5
How to reproduce
I prepared a simple example to shows a ~3x slower eval time for relevant Nickel versions in the below script (note the first run is pretty cold when pulling in the relevant nixpkg revisions):
#!/usr/bin/env bash
declare -A versions=(
["1_9_1"]="028048884dc9517e548703beb24a11408cc51402"
["1_10_1"]="98b397fb30e0599c7460e9d3233a6ea51a07c371"
["1_11_0"]="2795c506fe8fb7b03c36ccb51f75b6df0ab2553f"
)
printf "Evaluating the following expression: \n"
tee t.ncl <<< 'let S = { _: String } in let t = import "t.json" in t | S'
nickel export -o s.json <<EOF
let S = 10 in
let T = (std.array.generate (std.function.const "0") S |> std.string.join "") in
std.array.range 0 1000 |> std.array.map(fun i => {"%{i |> std.to_string}" = T}) |> std.record.merge_all
EOF
command="nickel --version && hyperfine --warmup 5 'nickel eval t.ncl'"
for version in "${!versions[@]}"
do
rev=${versions[$version]}
nix-shell -p nickel -p hyperfine -I nixpkgs="https://github.com/NixOS/nixpkgs/archive/$rev.tar.gz" --run "$command"
doneWhich gives me the following output (cleaned)
Evaluating the following expression:
let S = { _: String } in let t = import "t.json" in t | S
nickel-lang-cli nickel 1.9.1 (rev cargore)
Benchmark 1: nickel eval t.ncl
Time (mean ± σ): 28.5 ms ± 6.3 ms [User: 24.6 ms, System: 2.7 ms]
Range (min … max): 26.2 ms … 75.7 ms 94 runs
nickel-lang-cli nickel 1.11.0 (rev cargore)
Benchmark 1: nickel eval t.ncl
Time (mean ± σ): 70.7 ms ± 4.0 ms [User: 54.2 ms, System: 13.5 ms]
Range (min … max): 67.3 ms … 89.5 ms 40 runs
nickel-lang-cli nickel 1.10.0 (rev cargore)
Benchmark 1: nickel eval t.ncl
Time (mean ± σ): 68.5 ms ± 5.5 ms [User: 51.3 ms, System: 13.9 ms]
Range (min … max): 65.0 ms … 93.1 ms 42 runs