Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion benches/benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down
3 changes: 3 additions & 0 deletions benches/nu/for.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
for i in [1 2 3] {
print $i
}
21 changes: 21 additions & 0 deletions benches/nu/if_oneof.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
let x = 123

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
5 changes: 5 additions & 0 deletions benches/nu/while.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mut x = 100

while $x < 1000 {
$x = $x + 1
}