Merge ce5b95c63a
into 0178295363
This commit is contained in:
commit
9ba33c3e93
68
Cargo.lock
generated
68
Cargo.lock
generated
|
@ -380,12 +380,15 @@ dependencies = [
|
||||||
"itertools 0.12.1",
|
"itertools 0.12.1",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"lazycell",
|
"lazycell",
|
||||||
|
"log",
|
||||||
|
"prettyplease",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"regex",
|
"regex",
|
||||||
"rustc-hash",
|
"rustc-hash",
|
||||||
"shlex",
|
"shlex",
|
||||||
"syn 2.0.60",
|
"syn 2.0.60",
|
||||||
|
"which 4.4.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -2008,6 +2011,41 @@ dependencies = [
|
||||||
"want",
|
"want",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "iai-callgrind"
|
||||||
|
version = "0.10.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e99bf26f496b13ac6273014f40afda46a233fbfb0289ce50fb4daaad2f2ffc80"
|
||||||
|
dependencies = [
|
||||||
|
"bincode",
|
||||||
|
"bindgen",
|
||||||
|
"cc",
|
||||||
|
"iai-callgrind-macros",
|
||||||
|
"iai-callgrind-runner",
|
||||||
|
"regex",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "iai-callgrind-macros"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e2a4bb39225592c0a28cfca6f70af52ebd8da23f533c2cdd0a3329c1fa252d56"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro-error",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn 2.0.60",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "iai-callgrind-runner"
|
||||||
|
version = "0.10.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c23a951b9eccaa1e38556d27473d1462a9c247a27961812edcaac156af861282"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iana-time-zone"
|
name = "iana-time-zone"
|
||||||
version = "0.1.60"
|
version = "0.1.60"
|
||||||
|
@ -2874,6 +2912,7 @@ dependencies = [
|
||||||
"crossterm",
|
"crossterm",
|
||||||
"ctrlc",
|
"ctrlc",
|
||||||
"dirs-next",
|
"dirs-next",
|
||||||
|
"iai-callgrind",
|
||||||
"log",
|
"log",
|
||||||
"miette",
|
"miette",
|
||||||
"mimalloc",
|
"mimalloc",
|
||||||
|
@ -2951,7 +2990,7 @@ dependencies = [
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"unicode-segmentation",
|
"unicode-segmentation",
|
||||||
"uuid",
|
"uuid",
|
||||||
"which",
|
"which 6.0.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -3131,7 +3170,7 @@ dependencies = [
|
||||||
"uuid",
|
"uuid",
|
||||||
"v_htmlescape",
|
"v_htmlescape",
|
||||||
"wax",
|
"wax",
|
||||||
"which",
|
"which 6.0.1",
|
||||||
"windows 0.54.0",
|
"windows 0.54.0",
|
||||||
"winreg",
|
"winreg",
|
||||||
]
|
]
|
||||||
|
@ -3421,7 +3460,7 @@ dependencies = [
|
||||||
"nu-utils",
|
"nu-utils",
|
||||||
"num-format",
|
"num-format",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"which",
|
"which 6.0.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -4655,6 +4694,16 @@ dependencies = [
|
||||||
"yansi",
|
"yansi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "prettyplease"
|
||||||
|
version = "0.2.20"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"syn 2.0.60",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "print-positions"
|
name = "print-positions"
|
||||||
version = "0.6.1"
|
version = "0.6.1"
|
||||||
|
@ -4682,6 +4731,7 @@ dependencies = [
|
||||||
"proc-macro-error-attr",
|
"proc-macro-error-attr",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
"syn 1.0.109",
|
||||||
"version_check",
|
"version_check",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -6883,6 +6933,18 @@ dependencies = [
|
||||||
"url",
|
"url",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "which"
|
||||||
|
version = "4.4.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7"
|
||||||
|
dependencies = [
|
||||||
|
"either",
|
||||||
|
"home",
|
||||||
|
"once_cell",
|
||||||
|
"rustix",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "which"
|
name = "which"
|
||||||
version = "6.0.1"
|
version = "6.0.1"
|
||||||
|
|
|
@ -235,6 +235,7 @@ pretty_assertions = { workspace = true }
|
||||||
rstest = { workspace = true, default-features = false }
|
rstest = { workspace = true, default-features = false }
|
||||||
serial_test = "3.1"
|
serial_test = "3.1"
|
||||||
tempfile = { workspace = true }
|
tempfile = { workspace = true }
|
||||||
|
iai-callgrind = "0.10.2"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
plugin = [
|
plugin = [
|
||||||
|
@ -310,4 +311,9 @@ reedline = { git = "https://github.com/nushell/reedline", branch = "main" }
|
||||||
# Run individual benchmarks like `cargo bench -- <regex>` e.g. `cargo bench -- parse`
|
# Run individual benchmarks like `cargo bench -- <regex>` e.g. `cargo bench -- parse`
|
||||||
[[bench]]
|
[[bench]]
|
||||||
name = "benchmarks"
|
name = "benchmarks"
|
||||||
harness = false
|
harness = false
|
||||||
|
|
||||||
|
# cargo bench --bench iai_benchmarks -- --save-summary=pretty-json
|
||||||
|
[[bench]]
|
||||||
|
name = "iai_benchmarks"
|
||||||
|
harness = false
|
||||||
|
|
1217
benches/fixtures/json_example.json
Normal file
1217
benches/fixtures/json_example.json
Normal file
File diff suppressed because it is too large
Load Diff
1
benches/fixtures/math.nu
Normal file
1
benches/fixtures/math.nu
Normal file
File diff suppressed because one or more lines are too long
59
benches/iai_benchmarks.rs
Normal file
59
benches/iai_benchmarks.rs
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
use iai_callgrind::{
|
||||||
|
binary_benchmark_group, main, Arg, BinaryBenchmarkConfig, BinaryBenchmarkGroup, Fixtures, Run,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Callgrid is a benchmarking tool that simulate the execution of a program on a virtual machine.
|
||||||
|
// It is useful to measure the performance of a program in a controlled environment.
|
||||||
|
// See https://github.com/iai-callgrind/iai-callgrind?tab=readme-ov-file#installation for installation instructions.
|
||||||
|
// You can run this benchmark suit by running `cargo bench --bench iai_benchmarks`.
|
||||||
|
|
||||||
|
fn my_setup() {}
|
||||||
|
|
||||||
|
binary_benchmark_group!(
|
||||||
|
name = my_exe_group;
|
||||||
|
setup = my_setup;
|
||||||
|
// This directory will be copied into the root of the sandbox (as `fixtures`)
|
||||||
|
config = BinaryBenchmarkConfig::default().fixtures(Fixtures::new("benches/fixtures"));
|
||||||
|
benchmark =
|
||||||
|
|"nu", group: &mut BinaryBenchmarkGroup| {
|
||||||
|
setup_my_exe_group(group)
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
fn setup_my_exe_group(group: &mut BinaryBenchmarkGroup) {
|
||||||
|
group
|
||||||
|
.bench(Run::with_arg(Arg::new(
|
||||||
|
"standard startup",
|
||||||
|
["-c", "'exit'"],
|
||||||
|
)))
|
||||||
|
.bench(Run::with_arg(Arg::new(
|
||||||
|
"clean startup",
|
||||||
|
["--no-std-lib", "--no-history", "-n", "-c", "'exit'"],
|
||||||
|
)))
|
||||||
|
.bench(Run::with_arg(Arg::new(
|
||||||
|
"for loop",
|
||||||
|
[
|
||||||
|
"--no-std-lib",
|
||||||
|
"--no-history",
|
||||||
|
"-n",
|
||||||
|
"-c",
|
||||||
|
"'(for x in 1..10000 { echo $x }) | ignore'",
|
||||||
|
],
|
||||||
|
)))
|
||||||
|
.bench(Run::with_arg(Arg::new(
|
||||||
|
"open json",
|
||||||
|
[
|
||||||
|
"--no-std-lib",
|
||||||
|
"--no-history",
|
||||||
|
"-n",
|
||||||
|
"-c",
|
||||||
|
"'open fixtures/json_example.json'",
|
||||||
|
],
|
||||||
|
)))
|
||||||
|
.bench(Run::with_arg(Arg::new(
|
||||||
|
"math",
|
||||||
|
["--no-std-lib", "--no-history", "-n", "fixtures/math.nu"],
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
|
||||||
|
main!(binary_benchmark_groups = my_exe_group);
|
Loading…
Reference in New Issue
Block a user