External Publication
Visit Post

Changing the `Binary` instance for `Double` and `Float`

Haskell Community [Unofficial] March 6, 2026
Source

For context, quick search yields benchmarks from a decade ago (fpco, haskell-perf), though I don’t expect much has changed since.

elaforge:

was the stuff about binary being slow actually true?

“slow” doesn’t mean much in a well-written parser, they come with trade-offs:

  • Anything small will always be faster in an input-strict parser, since those work over a single continuous chunk of memory. Conversely anything huge may be handled more efficiently in an input-lazy parser;

  • A parser that supports streaming output can be used for incremental processing, and you’re kinda screwed otherwise if you need that;

  • Big data blobs (such as videogame resource files) can be parsed way more efficiently by memory-mapping the file and parsing each section in parallel (though memory-mapping is a platform-specific feature, so it’s a pain in the butt to set up).

In my experience binary parses a 35MB GameMaker resource file in a fraction of a second (~65ms as I check right now), so it’s more than fast enough for general use.

Discussion in the ATmosphere

Loading comments...