19{-| A wrapper around benchmark.js that allows benchmarking
20of pure functions to be evaluated.
22# Error and Benchmark types
23@docs Never, Benchmark, Suite, BenchStats
26@docs run, runWithProgress
29@docs bench, bench1, bench2, bench3, bench4, bench5, bench6, bench7, bench8, bench9
35import Native.Benchmark
36import Native.BenchmarkJS
42Our error return type: can never be instantiated
43because running benchmarks should not fail
50Opaque type representing a function to be timed
57The results of running a benchmark
63 , marginOfError : Float
65-- , numRunsSampled : Int
70A single or collection of benchmarks
71that can be run, generating output
74 SingleBenchmark Benchmark
75 | Suite String (List Benchmark)
79Run a benchmark, generating a list of results for each benchmark.
80Results contain a pretty-printed string summary, and a list
81of detailed data for each benchmark.
85 -> Task.Task Never (String, List BenchStats)
86run = runWithProgress Nothing
90Run a benchmark, generating a list of results for each benchmark
91and updating a String signal with progress as the benchmarks run
94 : Maybe (Signal.Mailbox String)
96 -> Task.Task Never (String, List BenchStats)
97runWithProgress maybeMailbox suite =
101 Nothing -> \_ -> Task.sleep 0
104 (Signal.send mailbox.address s
105 `Task.andThen` \_ -> Task.sleep (5*Time.second))
106 -- `Task.andThen` \_ -> Task.keepGoing
108 Native.Benchmark.runWithProgress ourTask suite
111Create a benchmark with the given name
112running an arbitrary thunk
114bench : String -> (() -> result) -> Benchmark
115bench = Native.Benchmark.makeBenchmark
119Functions for creating named benchmarks with 1 to 9 arguments
121bench1 : String -> (a -> result) -> a -> Benchmark
123 Native.Benchmark.makeBenchmark name (\_ -> f a)
127bench2 : String -> (a -> b -> result) -> a -> b -> Benchmark
129 Native.Benchmark.makeBenchmark name (\_ -> f a b)
133bench3 : String -> (a -> b -> c -> result) -> a -> b -> c -> Benchmark
135 Native.Benchmark.makeBenchmark name (\_ -> f a b c)
139bench4 : String -> (a -> b -> c -> d -> result) -> a -> b -> c -> d -> Benchmark
140bench4 name f a b c d =
141 Native.Benchmark.makeBenchmark name (\_ -> f a b c d)
145bench5 : String -> (a -> b -> c -> d -> e -> result) -> a -> b -> c -> d -> e -> Benchmark
146bench5 name f a b c d e =
147 Native.Benchmark.makeBenchmark name (\_ -> f a b c d e)
153 -> (a -> b -> c -> d -> e -> f -> result)
161bench6 name fn a b c d e f =
162 Native.Benchmark.makeBenchmark name (\_ -> fn a b c d e f)
168 -> (a -> b -> c -> d -> e -> f -> g -> result)
177bench7 name fn a b c d e f g =
178 Native.Benchmark.makeBenchmark name (\_ -> fn a b c d e f g)
184 -> (a -> b -> c -> d -> e -> f -> g -> h -> result)
194bench8 name fn a b c d e f g h =
195 Native.Benchmark.makeBenchmark name (\_ -> fn a b c d e f g h)
200 -> (a -> b -> c -> d -> e -> f -> g -> h -> i -> result)
211bench9 name fn a b c d e f g h i =
212 Native.Benchmark.makeBenchmark name (\_ -> fn a b c d e f g h i)
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