mirror of
https://github.com/swarm-game/swarm.git
synced 2024-09-11 14:46:33 +03:00
2c3fc525c9
* add wave program and parametrise it to compare inlined/generic version * use [`tasty-bench`](https://hackage.haskell.org/package/tasty-bench) library to show comparison * move benchmarks to test folder as they can now share tasty code * closes #1574 Using the recursive definition with ifs leads to a 3x slowdown: ``` wavesInlined 10: OK 361 ms ± 29 ms 20: OK 718 ms ± 35 ms 30: OK 1.066 s ± 28 ms 40: OK 1.437 s ± 37 ms wavesWithDef 10: OK 1.052 s ± 51 ms, 2.92x 20: OK 2.117 s ± 34 ms, 2.95x 30: OK 3.144 s ± 80 ms, 2.95x 40: OK 4.191 s ± 91 ms, 2.92x ``` But if we just inline and simplify the code, we can remove the runtime overhead completely.
6 lines
151 B
Bash
Executable File
6 lines
151 B
Bash
Executable File
#!/bin/bash -e
|
|
|
|
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
cd $SCRIPT_DIR/..
|
|
|
|
fourmolu --mode=inplace src app test |