The bytestring-lexing package offers efficient reading and packing of common types like
Administrative Changes (since 0.2.1)
Change of maintainer. Don Stewart handed maintainership of the package over to myself when I voiced interest.
Change of repo type. The old repo for the package used Darcs-1 style patches. I've converted the repository to Darcs-2 hashed. This means that the new repository cannot exchange patches with the old Darcs-1 repo (or any other Darcs-2 conversions that may be floating around out there). So anyone who's interested in contributing should scrap their local copies and get the new repo.
Code Changes (since 0.2.1)
Data.ByteString.Lex.Integral which provides efficient implementations for reading and packing/showing integral types in ASCII-compatible formats including decimal, hexadecimal, and octal.
readDecimal function in particular has been highly optimized. The new version is wicked fast and perfectly suitable for hot code locations like parsing headers for HTTP servers like Warp. In addition, attention has been paid to ensuring that parsing is efficient for larger than native types like Int64 on 32-bit systems (including 64-bit OS X), as well as Integer. The optimization of this function was done in collaboration with Erik de Castro Lopo, Vincent Hanquez, and Christoph Breitkopf following a blog post by Erik and ensuing discussion on Reddit.
A Criterion report is available for 64-bit Intel OS X running 32-bit GHC 6.12.1. The benchmark is included in the repo and has also been run on 64-bit GHC 7 systems, which differ primarily in not showing slowdown for Int64 vs Int (naturally). If you're curious about the different implementations:
- readIntBS / readIntegerBS --- are the readInt and readInteger functions in Data.ByteString
- readDecimalOrig (correct) --- was my original implementation, prior to collaboration with Erik, Vincent, and Christoph.
- readIntegralMH (buggy) --- or rather a non-buggy version very much like it, is the implementation currently used in Warp.
- readDecimal (current) --- is the current implementation used in this package.
- Homepage: http://code.haskell.org/~wren/
- Hackage: http://hackage.haskell.org/package/bytes
- Darcs: http://community.haskell.org/~wren/bytes
- Haddock: Darcs version