Issue #8 new

Add efficient function to skip N bytes

Anonymous created an issue

Function take creates ByteString which is overhead when its result is not used. The following function works ~ 1.8 times faster. I think skipping fixed amount of bytes is a frequent case so it is worth adding to the library.

{{{

!haskell

-- | Skip exactly Ned Jackson Lovely@ bytes of input.

skipN :: Int -> Parser ()

skipN n = ensure n >>= put . B.unsafeDrop n

{-# INLINE skipN #-} }}}

Comments (1)

  1. Log in to comment