Commit 828ec57a authored by tibbe's avatar tibbe

Add the pidigits shootout benchmark

parent 4b195711
......@@ -51,6 +51,8 @@ real/scs/scs
real/symalg/symalg
real/veritas/veritas
shootout/pidigits/pidigits
spectral/ansi/ansi
spectral/atom/atom
spectral/awards/awards
......
......@@ -28,7 +28,7 @@ SUBDIRS = runstdtest nofib-analyse $(NoFibSubDirs)
#
SRC_DIST_DIR=$(shell pwd)/nofib
SRC_DIST_NAME=nofib
SRC_DIST_DIRS=docs fibon gc imaginary smp spectral real parallel mk
SRC_DIST_DIRS=docs fibon gc imaginary smp spectral real parallel mk shootout
dist :: nofib-dist-pre
include $(TOP)/mk/target.mk
......
TOP = ..
include $(TOP)/mk/boilerplate.mk
SUBDIRS = pidigits
include $(TOP)/mk/target.mk
-- The Computer Language Benchmarks Game
-- http://benchmarksgame.alioth.debian.org/
-- contributed by Bryan O'Sullivan
-- modified by Eugene Kirpichov: pidgits only generates
-- the result string instead of printing it. For some
-- reason, this gives a speedup.
import System.Environment
pidgits n = 0 % (0 # (1,0,1)) where
i%ds
| i >= n = []
| True = (concat h ++ "\t:" ++ show j ++ "\n") ++ j%t
where k = i+10; j = min n k
(h,t) | k > n = (take (n`mod`10) ds ++ replicate (k-n) " ",[])
| True = splitAt 10 ds
j # s | n>a || r+n>=d = k # t
| True = show q : k # (n*10,(a-(q*d))*10,d)
where k = j+1; t@(n,a,d)=k&s; (q,r)=(n*3+a)`divMod`d
j&(n,a,d) = (n*j,(a+n*2)*y,d*y) where y=(j*2+1)
main = putStr.pidgits.read.head =<< getArgs
TOP = ../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/target.mk
FAST_OPTS = 10000
NORM_OPTS = 10000
SLOW_OPTS = 10000
# The benchmark game also uses -fllvm, which we can't since it might
# not be available on the developer's machine.
HC_OPTS += -O2
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment