Last active
August 29, 2015 14:17
-
-
Save aeyakovenko/bf558697a0b3f377f9e8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-- | |
$ dist/build/test/test | |
benchmarking P | |
time 3.217 s (NaN s .. 3.388 s) | |
0.998 R² (0.996 R² .. 1.000 R²) | |
mean 3.058 s (2.935 s .. 3.132 s) | |
std dev 112.5 ms (0.0 s .. 126.9 ms) | |
variance introduced by outliers: 19% (moderately inflated) | |
benchmarking S | |
time 2.626 s (2.211 s .. 2.913 s) | |
0.997 R² (0.991 R² .. 1.000 R²) | |
mean 2.843 s (2.816 s .. 2.860 s) | |
std dev 26.12 ms (0.0 s .. 30.08 ms) | |
variance introduced by outliers: 19% (moderately inflated) | |
perf log written to dist/perf-mmult.html | |
$ dist/build/test/test +RTS -N4 | |
benchmarking P | |
time 2.381 s (1.669 s .. 3.078 s) | |
0.988 R² (0.958 R² .. 1.000 R²) | |
mean 1.917 s (1.577 s .. 2.091 s) | |
std dev 295.3 ms (0.0 s .. 301.3 ms) | |
variance introduced by outliers: 46% (moderately inflated) | |
benchmarking S | |
time 2.796 s (2.661 s .. 3.101 s) | |
0.999 R² (NaN R² .. 1.000 R²) | |
mean 2.872 s (2.809 s .. 2.952 s) | |
std dev 72.97 ms (0.0 s .. 82.54 ms) | |
variance introduced by outliers: 19% (moderately inflated) | |
cabal file: | |
Benchmark test | |
type: exitcode-stdio-1.0 | |
ghc-options: -Wall -threaded -O3 -main-is Test.main | |
main-is: Test.hs | |
Build-Depends: base, | |
mtl, | |
repa, | |
repa-algorithms, | |
criterion | |
--} | |
module Test where | |
--benchmark modules | |
import Criterion.Main | |
import Criterion.Types | |
--impl modules | |
import Data.Array.Repa.Algorithms.Randomish | |
import Data.Array.Repa.Algorithms.Matrix | |
import Data.Array.Repa hiding((++)) | |
import qualified Data.Array.Repa as R | |
import Control.Applicative((<$>)) | |
main :: IO () | |
main = do | |
let file = "dist/perf-mmult.html" | |
cfg = defaultConfig { reportFile = Just file, timeLimit = 1.0 } | |
a1 = randomishDoubleArray (Z :. 1024 :. 1024) 0 1 0 | |
a2 = randomishDoubleArray (Z :. 1024 :. 1024) 0 1 0 | |
a1 `deepSeqArray` a2 `deepSeqArray` defaultMainWith cfg [ | |
bench "P" $ nfIO (R.toUnboxed <$> mmultP a1 a2) | |
, bench "S" $ whnf (R.toUnboxed . mmultS a1) a2 | |
] | |
putStrLn $ "perf log written to " ++ file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment