packages feed

vector-hashtables 0.1.1.0 → 0.1.1.1

raw patch · 3 files changed

+17/−12 lines, 3 filesdep ~hspecPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: hspec

API changes (from Hackage documentation)

Files

changelog.md view
@@ -1,3 +1,7 @@+# 0.1.1.1 (2021-09-10)++- Optimise `insertWithIndex` function ([#10](https://github.com/klapaucius/vector-hashtables/pull/10)).+ # 0.1.1.0 (2021-09-10)  - Add `alter` function to public interface ([#9](https://github.com/klapaucius/vector-hashtables/pull/9)).
src/Data/Vector/Hashtables/Internal.hs view
@@ -328,17 +328,18 @@ insertWithIndex   :: (MVector ks k, MVector vs v, PrimMonad m, Hashable k, Eq k)   => Int -> Int -> k -> v -> MutVar (PrimState m) (Dictionary_ (PrimState m) ks k vs v) -> Dictionary_ (PrimState m) ks k vs v -> Int -> m ()-insertWithIndex !targetBucket !hashCode' key' value' getDRef d@Dictionary{..} i-      | i >= 0 = do-           hc <- hashCode ! i-           if hc == hashCode'-               then do-                   k  <- key !~ i-                   if k == key'-                       then value <~~ i $ value'-                       else insertWithIndex targetBucket hashCode' key' value' getDRef d =<< next ! i-               else insertWithIndex targetBucket hashCode' key' value' getDRef d =<< next ! i-      | otherwise = addOrResize targetBucket hashCode' key' value' getDRef d+insertWithIndex !targetBucket !hashCode' key' value' getDRef d@Dictionary{..} = go where+  go i+    | i >= 0 = do+         hc <- hashCode ! i+         if hc == hashCode'+             then do+                 k  <- key !~ i+                 if k == key'+                     then value <~~ i $ value'+                     else go =<< next ! i+             else go =<< next ! i+    | otherwise = addOrResize targetBucket hashCode' key' value' getDRef d {-# INLINE insertWithIndex #-}  addOrResize
vector-hashtables.cabal view
@@ -1,5 +1,5 @@ name:                vector-hashtables-version:             0.1.1.0+version:             0.1.1.1 synopsis:            Efficient vector-based mutable hashtables implementation. description:   This package provides efficient vector-based hashtable implementation similar to .NET Generic Dictionary implementation (at the time of 2015).