nixir/tests/benchmark/large.nix
NotAShelf f385eebc99
tests: initial benchmarking setup
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: If0ed2dd4279abf155a8ddc678ca047736a6a6964
2026-02-23 02:26:37 +03:00

47 lines
759 B
Nix

# Large :b:oke ---I mean...benchmark, for stress testing
let
# Generate large list
range = start: end:
if start >= end
then []
else [start] ++ range (start + 1) end;
# Deep nesting
deepNest = {a = {b = {c = {d = {e = {f = 42;};};};};};};
# Large attrset
largeAttrs = {
a1 = 1;
a2 = 2;
a3 = 3;
a4 = 4;
a5 = 5;
a6 = 6;
a7 = 7;
a8 = 8;
a9 = 9;
a10 = 10;
b1 = 11;
b2 = 12;
b3 = 13;
b4 = 14;
b5 = 15;
b6 = 16;
b7 = 17;
b8 = 18;
b9 = 19;
b10 = 20;
};
# Recursive attrset
recursive = rec {
x = 10;
y = x * 2;
z = y + x;
result = z * 3;
};
in {
list_100 = range 1 100;
deep = deepNest.a.b.c.d.e.f;
inherit largeAttrs recursive;
}