Skip to content

Instantly share code, notes, and snippets.

@meiersi
meiersi / CollatzLength.hs
Created July 25, 2012 22:46
Solution to Euler Problem 14 using memoization via a lazy array
-- inspired by: http://scrollingtext.org/project-euler-problem-14
-- executing main takes 5 sec in ghci
-- 0.7 sec when compiled with -O
import qualified Data.Vector as V
n :: Integer
n = 1000000
cacheSize :: Int
@meiersi
meiersi / gist:3823534
Created October 2, 2012 21:50
benchmarks_after_pull_request
Running 1 benchmarks...
Benchmark benchmarks: RUNNING...
warming up
estimating clock resolution...
mean is 1.357818 us (640001 iterations)
found 3790 outliers among 639999 samples (0.6%)
3077 (0.5%) high severe
estimating cost of a clock call...
mean is 35.68071 ns (12 iterations)
found 2 outliers among 12 samples (16.7%)
@meiersi
meiersi / gist:3823539
Created October 2, 2012 21:51
benchmarks_before_pull_request
Running 1 benchmarks...
Benchmark benchmarks: RUNNING...
warming up
estimating clock resolution...
mean is 1.272820 us (640001 iterations)
found 155815 outliers among 639999 samples (24.3%)
4 (6.3e-4%) low severe
155811 (24.3%) high severe
estimating cost of a clock call...
mean is 34.57473 ns (12 iterations)