@@ -8,6 +8,7 @@ import qualified Data.ByteString.Lazy.Internal as BL
8
8
import Criterion.Main
9
9
import Data.Maybe (fromJust )
10
10
import qualified Data.Set as Set
11
+ import qualified Data.HashSet as HashSet
11
12
import qualified Data.ByteString.Lazy as BL
12
13
import qualified Data.UUID.Types as U
13
14
import Foreign (alloca , peek , poke )
@@ -24,6 +25,9 @@ main = do
24
25
u1 <- randomIO
25
26
let s1 = U. toString u1
26
27
b1 = U. toByteString u1
28
+ a1 = U. toASCIIBytes u1
29
+ t1 = U. toText u1
30
+ (w1a,w1b,w1c,w1d) = U. toWords u1
27
31
nil2 = fromJust $
28
32
U. fromString " 00000000-0000-0000-0000-000000000000"
29
33
u2a = fromJust $ U. fromString " 169a5a43-c051-4a16-98f4-08447ddd5dc0"
@@ -43,15 +47,25 @@ main = do
43
47
bench " null nil" $ whnf U. null U. nil,
44
48
bench " null nil2" $ whnf U. null nil2,
45
49
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
47
53
],
48
54
bgroup " conversion" [
49
55
bench " toString" $ nf U. toString u1,
50
56
bench " fromString" $ nf U. fromString s1,
51
57
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
53
65
],
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,
55
69
56
70
bgroup " storable" [
57
71
bench " peek" $ nfIO (peek uuidPtr),
0 commit comments