Skip to content

Commit 7485f5c

Browse files
authored
Remove custom unsafeShift{L,R} definitions (#281)
With GHC < 8.2, the standard `unsafeShift{L,R}` definitions aren't inlined properly in larger unfoldings. This results in benchmark slowdowns on the order of 1 to 6%.
1 parent 4bf0430 commit 7485f5c

File tree

3 files changed

+2
-20
lines changed

3 files changed

+2
-20
lines changed

Data/HashMap/Base.hs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ import Data.Semigroup (Semigroup((<>)))
129129
#endif
130130
import Control.DeepSeq (NFData(rnf))
131131
import Control.Monad.ST (ST)
132-
import Data.Bits ((.&.), (.|.), complement, popCount)
132+
import Data.Bits ((.&.), (.|.), complement, popCount, unsafeShiftL, unsafeShiftR)
133133
import Data.Data hiding (Typeable)
134134
import qualified Data.Foldable as Foldable
135135
#if MIN_VERSION_base(4,10,0)
@@ -144,7 +144,6 @@ import qualified Data.HashMap.Array as A
144144
import qualified Data.Hashable as H
145145
import Data.Hashable (Hashable)
146146
import Data.HashMap.Unsafe (runST)
147-
import Data.HashMap.UnsafeShift (unsafeShiftL, unsafeShiftR)
148147
import Data.HashMap.List (isPermutationBy, unorderedCompare)
149148
import Data.Typeable (Typeable)
150149

@@ -2101,7 +2100,7 @@ bitsPerSubkey :: Int
21012100
bitsPerSubkey = 4
21022101

21032102
maxChildren :: Int
2104-
maxChildren = fromIntegral $ 1 `unsafeShiftL` bitsPerSubkey
2103+
maxChildren = 1 `unsafeShiftL` bitsPerSubkey
21052104

21062105
subkeyMask :: Bitmap
21072106
subkeyMask = 1 `unsafeShiftL` bitsPerSubkey - 1

Data/HashMap/UnsafeShift.hs

Lines changed: 0 additions & 16 deletions
This file was deleted.

unordered-containers.cabal

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ library
4646
Data.HashMap.Strict.Base
4747
Data.HashMap.List
4848
Data.HashMap.Unsafe
49-
Data.HashMap.UnsafeShift
5049
Data.HashSet.Base
5150

5251
build-depends:

0 commit comments

Comments
 (0)