-
STEVAN Antoine authored
in `./bins/inbreeding/`, this MR does - refactor the "list item drawing" from `environment.rs` and `strategy.rs` into the `draw_unique_elements` function of new `random.rs` module - use a `HashSet` to draw unique indices in the slice of "things" to draw from and then extracts the items corresponding to these indices ## results ```bash use ./bins/inbreeding use std bench const PRNG_SEED = 0 const OPTS = { nb_bytes: (10 * 1_024), k: 10, n: 20, nb_measurements: 100, nb_scenarii: 10, measurement_schedule: 1, measurement_schedule_start: 2_000, max_t: 2_000, strategies: [ "single:5" ], environment: null, } def run [rev: string] { git co $rev inbreeding build let a = bench --rounds 5 { inbreeding run --options ($OPTS | update environment "fixed:0") --prng-seed $PRNG_SEED } let b = bench --rounds 5 { inbreeding run --options ($OPTS | update environment "fixed:1") --prng-seed $PRNG_SEED } { 0: $a, 1: $b, } } let main = run a29b511d let mr = run fix-shuffle ``` ```bash let table = [ [env, main, mr, improvement]; ["fixed:0", $main."0".mean, $mr."0".mean, (($main."0".mean - $mr."0".mean) / $main."0".mean * 100)], ["fixed:1", $main."1".mean, $mr."1".mean, (($main."1".mean - $mr."1".mean) / $main."1".mean * 100)], ] $table | to md --pretty ``` | env | main | mr | improvement | | ------- | ----------------------- | ----------------------- | ------------------ | | fixed:0 | 8sec 504ms 794µs 784ns | 6sec 353ms 206µs 645ns | 25.298530930431912 | | fixed:1 | 727ms 648µs 292ns | 639ms 443µs 782ns | 12.12186037811795 | the improvement is quite nice, even though not huge, but the code is cleaner anyways
47ba0de8
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
Forked from
Dragoon / Komodo
Source project has a limited visibility.