elm-explorations / elm-explorations/benchmark
Second function in `compare` reproducibly benchmarks faster than the first
- Dominant language
- Elm
- Stars
- 28
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
With the use of `compare`, if identical functions are supplied, the second will reproducibly benchmark ~10-30% faster than the first, regardless of what the functions are.
SSCCE:
```
module Test exposing (main)
import Benchmark exposing (Benchmark)
import Benchmark.Runner exposing (BenchmarkProgram, program)
main : BenchmarkProgram
main =
program suite
suite : Benchmark
suite =
Benchmark.compare "First vs. Second" "First" (\_ -> myFunction "zxcvbn") "Second" (\_ -> myFunction "zxcvbn")
myFunction : String -> String
myFunction =
String.reverse
```
and some results for various functions in `myFunction`:



This behavior extends to more complex functions as well, just presenting simple ones here so as to eliminate variables.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.