Change enlarge to eliminate a join point
authorRoman Leshchinskiy <rl@cse.unsw.edu.au>
Thu, 10 Dec 2009 10:34:08 +0000 (10:34 +0000)
committerRoman Leshchinskiy <rl@cse.unsw.edu.au>
Thu, 10 Dec 2009 10:34:08 +0000 (10:34 +0000)
Data/Vector/Generic/Mutable.hs

index b56d599..3852046 100644 (file)
@@ -268,9 +268,7 @@ grow :: (PrimMonad m, MVector v a)
 grow v by = BOUNDS_CHECK(checkLength) "grow" by
           $ unsafeGrow v by
 
-enlarge_delta v = max 1
-                $ double2Int
-                $ int2Double (length v) * gROWTH_FACTOR
+enlarge_delta v = double2Int (int2Double (length v) * gROWTH_FACTOR) + 1
 
 -- | Grow a vector logarithmically
 enlarge :: (PrimMonad m, MVector v a)