Skip to content
Snippets Groups Projects

migrate criterion benchmarks to PLNK

Merged STEVAN Antoine requested to merge migrate-criterion-benchmarks-to-plnk into main
Files
5
+ 75
6
@@ -52,19 +52,84 @@ python scripts/plot/multi_bar.py --title "complex curve group operations" -l "ti
)
```
## linear algebra
```nushell
let sizes = seq 0 7 | each { 2 ** $in }
cargo run --example bench_linalg -- --nb-measurements 10 ...$sizes
| lines
| each { from json }
| to ndjson # NOTE: see https://github.com/nushell/nushell/issues/12655
| save --force linalg.ndjson
```
```nushell
let linalg = open linalg.ndjson
| update times { each { $in / 1_000_000 } }
| insert mean {|it| $it.times | math avg}
| insert stddev {|it| $it.times | into float | math stddev}
| update label { parse "{op} {n}"}
| flatten --all label
| into int n
for it in [
[op, title];
["inverse", "time to inverse an nxn matrix on certain curves"],
["transpose", "time to transpose an nxn matrix on certain curves"],
["mul", "time to multiply two nxn matrices on certain curves"]
] {
python scripts/plot/plot.py ...[
--title $it.title
--x-label "size"
--y-label "time (in ms)"
(
$linalg
| where op == $it.op
| rename --column { n: "x", name: "curve", mean: "measurement", stddev: "error" }
| group-by curve --to-table
| update items { reject curve }
| to json
)
]
}
```
## oneshot benchmarks
these are benchmarks that run a single measurement, implemented as _examples_ in
`examples/benches/`.
### trusted setup
```nushell
let degrees = seq 0 15 | each { 2 ** $in }
let degrees = seq 0 13 | each { 2 ** $in }
cargo run --example bench_setup -- --nb-measurements 10 ...$degrees
| lines
| each { from json }
| to ndjson # NOTE: see https://github.com/nushell/nushell/issues/12655
| save --force setup.ndjson
```
```nushell
python scripts/plot/plot.py ...[
--title "time to create trusted setups for certain curves"
--x-label "degree"
--y-label "time (in ms)"
(
open setup.ndjson
| update times { each { $in / 1_000_000 } }
| insert mean {|it| $it.times | math avg}
| insert stddev {|it| $it.times | into float | math stddev}
| insert degree { get label | parse "degree {d}" | into record | get d | into int}
| insert curve {|it| if ($it.name | str starts-with "ARK") {
let c = $it.name | parse "ARK setup on {curve}" | into record | get curve
$"($c)-ark"
} else {
$it.name | parse "setup on {curve}" | into record | get curve
}}
| rename --column { degree: "x", mean: "measurement", stddev: "error" }
| group-by curve --to-table
| update items { reject curve }
| to json
)
]
```
### commit
```nushell
@@ -72,10 +137,6 @@ let degrees = seq 0 15 | each { 2 ** $in }
cargo run --example bench_commit -- --nb-measurements 10 ...$degrees
| lines
| each { from nuon }
| update times { each { $in / 1_000_000 * 1ms } }
| insert mean {|it| $it.times | math avg}
| insert stddev {|it| $it.times | into int | into float | math stddev | into int | into duration}
| update label { parse "degree {d}" | into record | get d | into int }
| to ndjson # NOTE: see https://github.com/nushell/nushell/issues/12655
| save --force commit.ndjson
```
@@ -85,7 +146,15 @@ python scripts/plot/plot.py ...[
--x-label "degree"
--y-label "time (in ms)"
(
open commit.ndjson | group-by curve --to-table | update items { reject curve } | to json
open commit.ndjson
| update times { each { $in / 1_000_000 } }
| insert mean {|it| $it.times | math avg}
| insert stddev {|it| $it.times | into float | math stddev}
| update label { parse "degree {d}" | into record | get d | into int }
| rename --column { label: "x", name: "curve", mean: "measurement", stddev: "error" }
| group-by curve --to-table
| update items { reject curve }
| to json
)
]
```
Loading