[commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: Tiny performance tweak. (7fda8bd)
git at git.haskell.org
git at git.haskell.org
Tue May 3 22:43:16 UTC 2016
Repository : ssh://git@git.haskell.org/bytestring
On branches: master,revert-46-patch-1,wip/nix-local-build
Link : http://git.haskell.org/packages/bytestring.git/commitdiff/7fda8bd8f5e13a1dddbe8baf16ac5f96b2586125
>---------------------------------------------------------------
commit 7fda8bd8f5e13a1dddbe8baf16ac5f96b2586125
Author: Sean <burton.seanr at gmail.com>
Date: Mon Sep 28 16:10:51 2015 +0100
Tiny performance tweak.
>---------------------------------------------------------------
7fda8bd8f5e13a1dddbe8baf16ac5f96b2586125
Data/ByteString.hs | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/Data/ByteString.hs b/Data/ByteString.hs
index 2737549..970693c 100644
--- a/Data/ByteString.hs
+++ b/Data/ByteString.hs
@@ -322,6 +322,7 @@ unsafeDupablePerformIO = unsafePerformIO
#endif
#if !MIN_VERSION_base(4,7,0)
+finiteBitSize :: Word -> Int
finiteBitSize = bitSize
#endif
@@ -1364,9 +1365,9 @@ breakSubstring pat =
m = k ^ lp
get = fromIntegral . unsafeIndex src
search !hs !i
- | hp == hs && pat `isPrefixOf` b = u
- | length src <= i = (src,empty) -- not found
- | otherwise = search hs' (i + 1)
+ | hp == hs && pat == unsafeTake lp b = u
+ | length src <= i = (src,empty) -- not found
+ | otherwise = search hs' (i + 1)
where
u@(_, b) = unsafeSplitAt (i - lp) src
hs' = hs * k +
More information about the ghc-commits
mailing list