Almost five years after I initially released criterion, I'm delighted to announce a major release with a large number of appealing new features.
As always, you can install the latest goodness using cabal install criterion, or fetch the source from github.
Please let me know if you find criterion useful!New documentation
All of the documentation lives in the github repo, so if you'd like to see something improved, please send a bug report or pull request.New execution engine
Criterion's model of execution has evolved, becoming vastly more reliable and accurate. It can now measure events that take just a few hundred picoseconds.benchmarking return () time 512.9 ps (512.8 ps .. 513.1 ps)
While almost all of the core types have changed, criterion should remain API-compatible with the vast majority of your benchmarking code.New metrics
In addition to wall-clock time, criterion can now measure and regress on the following metrics:
- CPU time
- CPU cycles
- bytes allocated
- number of garbage collections
- number of bytes copied during GC
- wall-clock time spent in mutator threads
- CPU time spent running mutator threads
- wall-clock time spent doing GC
- CPU time spent doing GC
Criterion now supports linear regression of a number of metrics.
Here's a regression conducted using --regress cycles:iters:cycles: 1.000 R² (1.000 R² .. 1.000 R²) iters 47.718 (47.657 .. 47.805)
The first line of the output is the R² goodness-of-fit measure for this regression, and the second is the number of CPU cycles (measured using the rdtsc instruction) to execute the operation in question (integer division).
This next regression uses --regress allocated:iters to measure the number of bytes allocated while constructing an IntMap of 40,000 values.allocated: 1.000 R² (1.000 R² .. 1.000 R²) iters 4.382e7 (4.379e7 .. 4.384e7)
(That's a little under 42 megabytes.)New outputs
While its support for active HTML has improved, criterion can also now output JSON and JUnit XML files.New internals
Criterion has received its first spring cleaning, and is much easier to understand as a result.Acknowledgments
I was inspired into some of this work by the efforts of the authors of the OCaml Core_bench package.</body> </html>
My current .cabal folder looks like
Can I delete all the files I've bolded?submitted by abhishkk65
[link] [2 comments]
I've heard responses that they do not interact since type classes are ad-hoc and parametricity requires parametric polymorphism as the name indicates.
But in Wadler's paper Theorems for Free! he gives examples of some theorems (given a : A → A′ and b : B → B′):sort : ∀X. (X → X → Bool) → [X] → [X] if for all x, y ∈ A, (x < y) = (a x <′ a y) then map a ∘ sort (<) = sort (<′) ∘ map a fold : ∀X. ∀Y. (X → Y → Y) → Y → [X] → Y if for all x ∈ A, y ∈ B, b (x ⊕ y) = (a x) ⊛ (b y) and b u = u′ then b ∘ fold (⊕) u = fold (⊛) u′ ∘ map a
sort corresponds to Haskell's Data.List.sortBy but you could also view both of those parametrically polymorphic functions as ad-hoc functions whose type constraints (Ord and Foldable) have been reified into arguments. So is it valid to view ad-hoc polymorphic functions such as \x -> x == x with type Eq a => a -> Bool as having the following parametric type (a -> a -> Bool) -> a -> Bool (ignoring (/=))?submitted by haskellthrowaway
[link] [11 comments]
Given a function of the following type:f :: [a] -> [a]
Due to parametricity, the only information f has to make choices is the length of its input list since that is the only “element-independent “information content” of a list”.
Is there a name for this information, the information content you can retrieve from a data type when one or more of its types are parametrically polymorphic.submitted by haskellthrowaway
[link] [16 comments]
I guess it would be much slower, or else why would anyone use CUDA. But has anyone benchmarked it? How does it compare?submitted by SrPeixinho
[link] [7 comments]