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",
|
||||
"lazy_static",
|
||||
"lazycell",
|
||||
"log",
|
||||
"prettyplease",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"regex",
|
||||
"rustc-hash",
|
||||
"shlex",
|
||||
"syn 2.0.60",
|
||||
"which 4.4.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2008,6 +2011,41 @@ dependencies = [
|
|||
"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]]
|
||||
name = "iana-time-zone"
|
||||
version = "0.1.60"
|
||||
|
@ -2874,6 +2912,7 @@ dependencies = [
|
|||
"crossterm",
|
||||
"ctrlc",
|
||||
"dirs-next",
|
||||
"iai-callgrind",
|
||||
"log",
|
||||
"miette",
|
||||
"mimalloc",
|
||||
|
@ -2951,7 +2990,7 @@ dependencies = [
|
|||
"tempfile",
|
||||
"unicode-segmentation",
|
||||
"uuid",
|
||||
"which",
|
||||
"which 6.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3131,7 +3170,7 @@ dependencies = [
|
|||
"uuid",
|
||||
"v_htmlescape",
|
||||
"wax",
|
||||
"which",
|
||||
"which 6.0.1",
|
||||
"windows 0.54.0",
|
||||
"winreg",
|
||||
]
|
||||
|
@ -3421,7 +3460,7 @@ dependencies = [
|
|||
"nu-utils",
|
||||
"num-format",
|
||||
"tempfile",
|
||||
"which",
|
||||
"which 6.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -4655,6 +4694,16 @@ dependencies = [
|
|||
"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]]
|
||||
name = "print-positions"
|
||||
version = "0.6.1"
|
||||
|
@ -4682,6 +4731,7 @@ dependencies = [
|
|||
"proc-macro-error-attr",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
|
@ -6883,6 +6933,18 @@ dependencies = [
|
|||
"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]]
|
||||
name = "which"
|
||||
version = "6.0.1"
|
||||
|
|
|
@ -235,6 +235,7 @@ pretty_assertions = { workspace = true }
|
|||
rstest = { workspace = true, default-features = false }
|
||||
serial_test = "3.1"
|
||||
tempfile = { workspace = true }
|
||||
iai-callgrind = "0.10.2"
|
||||
|
||||
[features]
|
||||
plugin = [
|
||||
|
@ -311,3 +312,8 @@ reedline = { git = "https://github.com/nushell/reedline", branch = "main" }
|
|||
[[bench]]
|
||||
name = "benchmarks"
|
||||
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