Skip to content

Commit

Permalink
Make the benchmarks fairer for bytestring-trie
Browse files Browse the repository at this point in the history
  • Loading branch information
lowasser committed Feb 17, 2011
1 parent fa60a1d commit c3ba5e5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions BSTrieBench.hs
Expand Up @@ -28,15 +28,15 @@ shuffleM xs = forM_ [0..VM.length xs - 1] $ \ i -> do
j <- getRandomR (0, VM.length xs - 1) j <- getRandomR (0, VM.length xs - 1)
lift $ VM.swap xs i j lift $ VM.swap xs i j


tSortBench strings = toList (fromList strings) tSortBench strings = keys (fromList strings)


tLookupBench (strings, s1, s2) = (s1 `member` strings, s2 `member` strings) tLookupBench (strings, s1, s2) = (s1 `member` strings, s2 `member` strings)


tUnionBench (strings, revs) = size strings + size revs - size (unionL strings revs) tUnionBench (strings, revs) = unionL strings revs `seq` ()


tFilterBench strings = size (filterMap (\ str -> if not (BS.null str) && BS.last str /= 's' then Just str else Nothing) strings) tFilterBench strings = filterMap (\ str -> if not (BS.null str) && BS.last str /= 's' then Just str else Nothing) strings `seq` ()


tFromList strings = size (fromList strings) tFromList strings = fromList strings `seq` ()
tToList strs = sum [BS.length str | (str, _) <- toList strs] tToList strs = sum [BS.length str | (str, _) <- toList strs]


tInsert strs = insert s s strs `seq` () tInsert strs = insert s s strs `seq` ()
Expand Down

0 comments on commit c3ba5e5

Please sign in to comment.