Get updates via , Github, or RSS | About

Episode 31: Elm Benchmark Apr 20, 2017

Nothing settles a debate like cold, hard facts. If you wrote a function that you think is the fastest algorithm possible, the only way to know for sure is to test it. Elm-Benchmark looks similar to Elm-Test, but instead of checking for correctness, it checks for speed.

Examples

benchmarks/Main.elm

module Main exposing (..)

import Benchmark exposing (Benchmark, describe)
import Benchmark.Runner exposing (BenchmarkProgram, program)
import Model exposing (..)


suite : Benchmark
suite =
    describe "Shuffle"
        [ Benchmark.compare "shufflers"
          (Benchmark.benchmark1 "array" shuffledDeck 0)
          (Benchmark.benchmark1 "naive" naiveShuffledDeck 0)
        ]


main : BenchmarkProgram
main =
    program suite