on master help sign in
benchmarks now work with criterion 0.4
commitb3dd680b123e754bb8e6771b5d4a935b6727340d authoraslatter <aslatter@gmail.com> dateSat 2 Jan 2010, 23:40 (17 years ago) parentf872562
2 files changed+20−11
tests/BenchUUID.hs+18−9 uuid.cabal+2−2
tests/BenchUUID.hs+18−9
@@ -35,18 +35,27 @@ main = do
3535 n1 = (map (fromIntegral . ord) "http://www.haskell.org/") :: [Word8]
3636 defaultMain [
3737 bgroup "null" [
38− bench "null" $ B U.null u1,
39− bench "null nil" $ B U.null U.nil
38+ bench "null" $ whnf U.null u1,
39+ bench "null nil" $ whnf U.null U.nil
4040 ],
4141 bgroup "conversion" [
42− bench "toString" $ B (rnf . U.toString) u1,
43− bench "fromString" $ B (rnf . U.fromString) s1,
44− bench "toByteString" $ B (rnf . U.toByteString) u1,
45− bench "fromByteString" $ B (rnf . U.fromByteString) b1
42+ bench "toString" $ nf U.toString u1,
43+ bench "fromString" $ nf U.fromString s1,
44+ bench "toByteString" $ nf U.toByteString u1,
45+ bench "fromByteString" $ nf U.fromByteString b1
4646 ],
4747 bgroup "generation" [
48− bench "V1" $ rnf `fmap` U.nextUUID,
49− bench "V4" $ rnf `fmap` (randomIO :: IO U.UUID),
50− bench "V5" $ B (rnf . U.generateNamed U.namespaceURL) n1
48+ bench "V1" $ nfIO U.nextUUID,
49+ bench "V4" $ nfIO (randomIO :: IO U.UUID),
50+ bench "V5" $ nf (U.generateNamed U.namespaceURL) n1
5151 ]
5252 ]
53+
54+#if !(MIN_VERSION_criterion(0,4,0))
55+nf f arg = B ( rnf . f) arg
56+whnf f arg = B f arg
57+#endif
58+
59+#if !(MIN_VERSION_criterion(0,4,1))
60+nfIO act = rnf `fmap` act
61+#endif
uuid.cabal+2−2
@@ -45,12 +45,12 @@ Library
4545Executable benchuuid
4646 Main-Is: BenchUUID.hs
4747 HS-Source-Dirs: tests .
48− Extensions: DeriveDataTypeable
48+ Extensions: DeriveDataTypeable, CPP
4949 If flag(test)
5050 Buildable: True
5151 Build-Depends: random, binary, bytestring, Crypto, maccatcher,
5252 time, base >=3, base < 5,
53− criterion >= 0.3 && < 0.4, parallel >= 2.1 && < 2.3
53+ criterion >= 0.3 && < 0.5, parallel >= 2.1 && < 2.3
5454 Else
5555 Buildable: False
5656