Commits

Bryan O'Sullivan  committed b1d2b51

Replace uses of quot and rem with quotRem

Astonishingly (at least to me), this improves performance by almost
30% for large integers.

  • Participants
  • Parent commits de7a10e

Comments (0)

Files changed (1)

File Data/Text/Lazy/Builder/Int.hs

 posDecimal marr off0 ds v0 = go (off0 + ds - 1) v0
   where go off v
            | v >= 100 = do
-               write2 off $ let u = v `rem` 100
-                            in u + u
-               go (off - 2) (v `quot` 100)
+               let (q, r) = v `quotRem` 100
+               write2 off (r + r)
+               go (off - 2) q
            | v < 10    = unsafeWrite marr off (i2w v)
            | otherwise = write2 off (v + v)
         write2 off i = do