9{-| A wrapper around benchmark.js that allows benchmarking of pure functions.
12@docs Benchmark, test, suite
19import Native.Benchmark
20import Native.BenchmarkJS
23import Html exposing (Html, div, ul, li, p, text)
24import Html.Attributes exposing (style)
28-- SET UP BENCHMARK SUITE
31{-| A set of benchmarks. -}
34 | Suite String (List Benchmark)
40{-| An individual benchmark with a name. It measures how long it takes to
41evaluate the given function when it is passed a `()` value.
43test : String -> (() -> result) -> Benchmark
45 Test name (Native.Benchmark.makeThunk thunk)
48{-| A collection of benchmarks to run together.
50suite : String -> List Benchmark -> Benchmark
61 = StatSuite String (List Statistics)
70run : Benchmark -> Task.Task x Statistics
79view : Statistics -> Html
86viewHelp : Statistics -> Html
90 text (name ++ " - " ++ prettyFloat hz ++ " ops/sec")
92 StatSuite name subStats ->
95 List.map viewHelp subStats
99 , ul [] (List.map (\html -> li [] [html]) subResults)
103prettyFloat : Float -> String
105 String.join "," (numberChunker (round float) [])
108numberChunker : Int -> List String -> List String
109numberChunker n chunks =
118 toString chunk :: chunks
121 numberChunker next (String.padLeft 3 '0' (toString chunk) :: chunks)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list