From 3238c10ab68b7e83a369b5639d78fc070a6b34a0 Mon Sep 17 00:00:00 2001 From: innocentzero <1nn0c3n7z3r0@proton.me> Date: Fri, 13 Feb 2026 13:18:41 +0530 Subject: [PATCH 1/2] Add more benchmark tests Signed-off-by: innocentzero <1nn0c3n7z3r0@proton.me> --- benches/benchmarks.rs | 4 +++- benches/nu/for.nu | 3 +++ benches/nu/if_oneof.nu | 9 +++++++++ benches/nu/while.nu | 5 +++++ 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 benches/nu/for.nu create mode 100644 benches/nu/if_oneof.nu create mode 100644 benches/nu/while.nu diff --git a/benches/benchmarks.rs b/benches/benchmarks.rs index 60db6f2..0479d2b 100644 --- a/benches/benchmarks.rs +++ b/benches/benchmarks.rs @@ -14,7 +14,9 @@ use new_nu_parser::resolver::Resolver; use new_nu_parser::typechecker::Typechecker; /// Files in benches/nu/ we want to benchmark (without .nu suffix) -const BENCHMARKS: &[&str] = &["def", "if", "combined", "int100"]; +const BENCHMARKS: &[&str] = &[ + "int100", "def", "if", "for", "while", "if_oneof", "combined", +]; const ITERATIONS: &[usize] = &[1, 10, 100, 1_000, 10_000]; diff --git a/benches/nu/for.nu b/benches/nu/for.nu new file mode 100644 index 0000000..1fc85a0 --- /dev/null +++ b/benches/nu/for.nu @@ -0,0 +1,3 @@ +for i in [1 2 3] { + print $i +} diff --git a/benches/nu/if_oneof.nu b/benches/nu/if_oneof.nu new file mode 100644 index 0000000..94f0181 --- /dev/null +++ b/benches/nu/if_oneof.nu @@ -0,0 +1,9 @@ +let x = 123 + +if $x < 100 { + 5 +} else if $x > 200 { + "foo" +} else { + null +} diff --git a/benches/nu/while.nu b/benches/nu/while.nu new file mode 100644 index 0000000..f3c4bfa --- /dev/null +++ b/benches/nu/while.nu @@ -0,0 +1,5 @@ +mut x = 100 + +while $x < 1000 { + $x = $x + 1 +} From 2e8ca8f954239025a57c3d5fe942bbde9931df6f Mon Sep 17 00:00:00 2001 From: innocentzero <1nn0c3n7z3r0@proton.me> Date: Fri, 20 Feb 2026 13:56:34 +0530 Subject: [PATCH 2/2] Add explicit oneof type Signed-off-by: innocentzero <1nn0c3n7z3r0@proton.me> --- benches/nu/if_oneof.nu | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/benches/nu/if_oneof.nu b/benches/nu/if_oneof.nu index 94f0181..d74e5e6 100644 --- a/benches/nu/if_oneof.nu +++ b/benches/nu/if_oneof.nu @@ -1,9 +1,21 @@ let x = 123 -if $x < 100 { +let z = if $x < 50 { + null +} else if $x > 100 { + 10 +} else { + [1 2 "foo"] +} + +let y = if $x < 100 { 5 } else if $x > 200 { "foo" } else { null } + +let $y = $z + +$y