Permalink
Browse files

Turn Bench.Primes into proper benchmark

  • Loading branch information...
1 parent 5c60947 commit eef88a4c9e45b4b5e2221dfb5e098e8095a56c90 @nominolo committed Oct 22, 2012
Showing with 12 additions and 2 deletions.
  1. +12 −2 tests/Bench/Primes.hs
View
@@ -1,7 +1,11 @@
-{-# LANGUAGE NoImplicitPrelude, BangPatterns, MagicHash #-}
+{-# LANGUAGE NoImplicitPrelude, BangPatterns, MagicHash, CPP #-}
-- RUN: %bc_vm_chk
-- CHECK: @Result@ IND -> GHC.Bool.True`con_info
+#ifdef BENCH_GHC
+import Prelude ( print )
+#else
module Bench.Primes where
+#endif
import GHC.Prim
import GHC.Bool
@@ -10,6 +14,10 @@ import GHC.Base
import GHC.Num
import GHC.List
+#ifdef BENCH_GHC
+main = print bench
+#endif
+
isdivs :: Int -> Int -> Bool
isdivs n x = modInt x n /= 0
@@ -28,7 +36,9 @@ root n = primes !! n
test =
root 25 == 101
- --(root 1500 == 12569)
+
+bench =
+ root 1500 == 12569
{-
Example Trace:

0 comments on commit eef88a4

Please sign in to comment.