@@ -8,6 +8,7 @@ import qualified Data.ByteString.Lazy.Internal as BL
88import Criterion.Main
99import Data.Maybe (fromJust )
1010import qualified Data.Set as Set
11+ import qualified Data.HashSet as HashSet
1112import qualified Data.ByteString.Lazy as BL
1213import qualified Data.UUID.Types as U
1314import Foreign (alloca , peek , poke )
@@ -24,6 +25,9 @@ main = do
2425 u1 <- randomIO
2526 let s1 = U. toString u1
2627 b1 = U. toByteString u1
28+ a1 = U. toASCIIBytes u1
29+ t1 = U. toText u1
30+ (w1a,w1b,w1c,w1d) = U. toWords u1
2731 nil2 = fromJust $
2832 U. fromString " 00000000-0000-0000-0000-000000000000"
2933 u2a = fromJust $ U. fromString " 169a5a43-c051-4a16-98f4-08447ddd5dc0"
@@ -43,15 +47,25 @@ main = do
4347 bench " null nil" $ whnf U. null U. nil,
4448 bench " null nil2" $ whnf U. null nil2,
4549 bench " eq same" $ whnf (== u2a) u2b,
46- bench " eq differ" $ whnf (== u2a) u3
50+ bench " eq differ" $ whnf (== u2a) u3,
51+ bench " compare same" $ whnf (compare u2a) u2b,
52+ bench " compare differ" $ whnf (compare u2a) u3
4753 ],
4854 bgroup " conversion" [
4955 bench " toString" $ nf U. toString u1,
5056 bench " fromString" $ nf U. fromString s1,
5157 bench " toByteString" $ nf U. toByteString u1,
52- bench " fromByteString" $ nf U. fromByteString b1
58+ bench " fromByteString" $ nf U. fromByteString b1,
59+ bench " toASCIIBytes" $ nf U. toASCIIBytes u1,
60+ bench " fromASCIIBytes" $ nf U. fromASCIIBytes a1,
61+ bench " toWords" $ nf U. toWords u1,
62+ bench " fromWords" $ nf (U. fromWords w1a w1b w1c) w1d,
63+ bench " toText" $ nf U. toText u1,
64+ bench " fromText" $ nf U. fromText t1
5365 ],
54- bench " set making" $ nf Set. fromList uuids,
66+
67+ bench " Set making" $ nf Set. fromList uuids,
68+ bench " HashSet making" $ nf HashSet. fromList uuids,
5569
5670 bgroup " storable" [
5771 bench " peek" $ nfIO (peek uuidPtr),
0 commit comments