Skip to content

Commit

Permalink
Remove custom unsafeShift{L,R} definitions (#281)
Browse files Browse the repository at this point in the history
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%.
  • Loading branch information
sjakobi authored Jul 12, 2020
1 parent 4bf0430 commit 7485f5c
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 20 deletions.
5 changes: 2 additions & 3 deletions Data/HashMap/Base.hs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ import Data.Semigroup (Semigroup((<>)))
#endif
import Control.DeepSeq (NFData(rnf))
import Control.Monad.ST (ST)
import Data.Bits ((.&.), (.|.), complement, popCount)
import Data.Bits ((.&.), (.|.), complement, popCount, unsafeShiftL, unsafeShiftR)
import Data.Data hiding (Typeable)
import qualified Data.Foldable as Foldable
#if MIN_VERSION_base(4,10,0)
Expand All @@ -144,7 +144,6 @@ import qualified Data.HashMap.Array as A
import qualified Data.Hashable as H
import Data.Hashable (Hashable)
import Data.HashMap.Unsafe (runST)
import Data.HashMap.UnsafeShift (unsafeShiftL, unsafeShiftR)
import Data.HashMap.List (isPermutationBy, unorderedCompare)
import Data.Typeable (Typeable)

Expand Down Expand Up @@ -2101,7 +2100,7 @@ bitsPerSubkey :: Int
bitsPerSubkey = 4

maxChildren :: Int
maxChildren = fromIntegral $ 1 `unsafeShiftL` bitsPerSubkey
maxChildren = 1 `unsafeShiftL` bitsPerSubkey

subkeyMask :: Bitmap
subkeyMask = 1 `unsafeShiftL` bitsPerSubkey - 1
Expand Down
16 changes: 0 additions & 16 deletions Data/HashMap/UnsafeShift.hs

This file was deleted.

1 change: 0 additions & 1 deletion unordered-containers.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ library
Data.HashMap.Strict.Base
Data.HashMap.List
Data.HashMap.Unsafe
Data.HashMap.UnsafeShift
Data.HashSet.Base

build-depends:
Expand Down

0 comments on commit 7485f5c

Please sign in to comment.