Skip to content

Instantly share code, notes, and snippets.

import qualified Data.ByteString as S
import qualified Data.ByteString.Lazy as L
import Blaze.ByteString.Builder
import Blaze.ByteString.Builder.Char.Utf8 (fromString)
import Data.Monoid
infixl 4 <>
running benchmarks for 1 chunk size in bytes
collecting 100 samples, 1 iterations each, in estimated 24.22919 s
collecting 100 samples, 1 iterations each, in estimated 4.534197 s
collecting 100 samples, 1 iterations each, in estimated 5.621886 s
ranking for 1 chunk size in bytes
1. compaction only: mean 3.469537 ms (2p 3.352643 ms, 98p 4.173089 ms, out 10)
2. with compaction: mean 6.508811 ms (2p 6.260396 ms, 98p 7.141438 ms, out 4)
3. direct: mean 138.4184 ms (2p 128.6385 ms, 98p 154.6016 ms, out 0)
@meiersi
meiersi / gist:881389
Created March 22, 2011 15:17
Benchmarks results for using 'Write's when doing JSON String encoding.
┌─(simon@bumped)-(~/repositories/git/github/meiersi/aeson/benchmarks)-(master ?)
└─╼ ./AesonEncodeOld 500 json-data/*.json
json-data/example.json:
0.047853s
10449 per second
json-data/integers.json:
0.123015s
4065 per second
json-data/jp100.json:
0.937498s
-- Required for the MaybeC example below.
{-# LANGUAGE Rank2Types #-}
-- | HaskellerZ sketch-book from Juli 11th, 2011
module HaskellerZ where
import qualified Data.Map as M
import Control.Monad.State
import Control.Monad.Identity()
@meiersi
meiersi / gist:1754062
Created February 6, 2012 18:56
aeson benchmarks
benchmarking decode/en/aeson
mean: 1.549123 ms, lb 1.519203 ms, ub 1.589703 ms, ci 0.950
std dev: 177.1128 us, lb 137.1106 us, ub 225.7957 us, ci 0.950
found 10 outliers among 100 samples (10.0%)
3 (3.0%) high mild
7 (7.0%) high severe
variance introduced by outliers: 83.157%
variance is severely inflated by outliers
@meiersi
meiersi / gist:2362561
Created April 11, 2012 21:02
benchmarking bytestring to hex-string conversion
./dist/build/bench-bytestring-builder/bench-bytestring-builder snoyman
Sanity checks:
lengths of input data: [10001,10001,10001,10001,10001,10001,10001]
warming up
estimating clock resolution...
mean is 5.480878 us (160001 iterations)
found 3843 outliers among 159999 samples (2.4%)
3403 (2.1%) high severe
estimating cost of a clock call...
@meiersi
meiersi / lists_of_size_10
Created April 24, 2012 19:39
Benchmark results from comparing cereal, binary, and the new bytestring builder on https://github.com/meiersi/cereal/blob/master/bench/BenchAll.hs
└─╼ ./cabal-dev/bin/cereal-bench
Sanity checks:
lengths of input data: [11,11,11,11,11,11,11]
cereal :/[Int]: 96
binary :/[Int]: 96
new builder :/[Int]: 100
new builder2:/[Int]: 96
cereal :/[String]: 138
binary :/[String]: 138
@meiersi
meiersi / gist:2487861
Created April 25, 2012 07:44
Decimal encoding speed
-- |
-- Copyright : (c) 2012 Simon Meier
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : Simon Meier <iridcode@gmail.com>
-- Stability : experimental
-- Portability : tested on GHC only
--
-- Benchmark decimal encoding speed of 10 million integers.
--
@meiersi
meiersi / gist:2488098
Created April 25, 2012 08:09
Benchmarking bytestring to hex conversion
-- Copyright : (c) 2012 Michael Snoyman, Simon Meier
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : Simon Meier <iridcode@gmail.com>
-- Stability : experimental
-- Portability : tested on GHC only
--
-- Benchmark hexadecimal encoding speed. Use the preview repository of the new
-- bytestring builder to test this code:
--
@meiersi
meiersi / gist:2666171
Created May 12, 2012 11:59
benchmarks of blaze-binary using GHC 7.4.1
benchmarked against: https://github.com/meiersi/blaze-binary/commit/d2bc3f004f608ebdd1eece624f288a263753bb36
and https://github.com/kolmodin/binary/commit/abbf46373620b45caca64e1072b300379e9c0fa1
warming up
estimating clock resolution...
mean is 1.466016 us (640001 iterations)
found 3590 outliers among 639999 samples (0.6%)
2943 (0.5%) high severe
estimating cost of a clock call...
mean is 36.12254 ns (13 iterations)