Run benchmarks for longer, added README to benchmarks

This commit is contained in:
Anton-4 2021-06-04 20:00:45 +02:00
parent 960a4fddc5
commit 4beac319bc
4 changed files with 30 additions and 12 deletions

View File

@ -115,6 +115,7 @@ bench-roc:
FROM +copy-dirs-and-cache
ENV RUST_BACKTRACE=full
RUN cargo criterion -V
RUN ulimit -s unlimited # to prevent stack overflow errors for CFold
RUN --privileged --mount=type=cache,target=$SCCACHE_DIR \
cd cli && cargo criterion && sccache --show-stats

17
cli/benches/README.md Normal file
View File

@ -0,0 +1,17 @@
# Running the benchmarks
Install cargo criterion:
```
cargo install cargo-criterion
```
To prevent stack overflow on the `CFold` benchmark:
```
ulimit -s unlimited
```
In the `cli` folder execute:
```
cargo criterion
```

View File

@ -13,10 +13,10 @@ fn bench_group_wall_time(c: &mut Criterion) {
let bench_funcs: Vec<fn(Option<&mut BenchmarkGroup<WallTime>>) -> ()> = vec![
bench_nqueens, // queens 11
bench_cfold, // e = mkExpr 12 1
bench_deriv, // nest deriv 7 f
bench_rbtree_ck, // ms = makeMap 5 5600
bench_rbtree_delete, // m = makeMap 6000
bench_cfold, // e = mkExpr 17 1
bench_deriv, // nest deriv 8 f
bench_rbtree_ck, // ms = makeMap 5 80000
bench_rbtree_delete, // m = makeMap 100000
bench_quicksort, // list size 2000
];

View File

@ -87,9 +87,9 @@ pub fn bench_nqueens<T: Measurement>(bench_group_opt: Option<&mut BenchmarkGroup
pub fn bench_cfold<T: Measurement>(bench_group_opt: Option<&mut BenchmarkGroup<T>>) {
exec_bench_w_input(
&example_file("benchmarks", "CFold.roc"),
"12",
"17",
"cfold",
"10426 & 10426\n",
"396354 & 396354\n",
bench_group_opt,
);
}
@ -97,9 +97,9 @@ pub fn bench_cfold<T: Measurement>(bench_group_opt: Option<&mut BenchmarkGroup<T
pub fn bench_deriv<T: Measurement>(bench_group_opt: Option<&mut BenchmarkGroup<T>>) {
exec_bench_w_input(
&example_file("benchmarks", "Deriv.roc"),
"7",
"8",
"deriv",
"1 count: 6\n2 count: 22\n3 count: 90\n4 count: 420\n5 count: 2202\n6 count: 12886\n7 count: 83648\n",
"1 count: 6\n2 count: 22\n3 count: 90\n4 count: 420\n5 count: 2202\n6 count: 12886\n7 count: 83648\n8 count: 598592\n",
bench_group_opt,
);
}
@ -107,9 +107,9 @@ pub fn bench_deriv<T: Measurement>(bench_group_opt: Option<&mut BenchmarkGroup<T
pub fn bench_rbtree_ck<T: Measurement>(bench_group_opt: Option<&mut BenchmarkGroup<T>>) {
exec_bench_w_input(
&example_file("benchmarks", "RBTreeCk.roc"),
"5600",
"80000",
"rbtree-ck",
"560\n",
"8000\n",
bench_group_opt,
);
}
@ -117,9 +117,9 @@ pub fn bench_rbtree_ck<T: Measurement>(bench_group_opt: Option<&mut BenchmarkGro
pub fn bench_rbtree_delete<T: Measurement>(bench_group_opt: Option<&mut BenchmarkGroup<T>>) {
exec_bench_w_input(
&example_file("benchmarks", "RBTreeDel.roc"),
"6000",
"100000",
"rbtree-del",
"420\n",
"7000\n",
bench_group_opt,
);
}