4 ms·
Attoparsec is a whole lot faster than Parsec. Orders of magnitude faster for many parsers. There is a common problem with most of these parser combinator libra
by enigmo 13y ago
Attoparsec is a whole lot faster than Parsec. Orders of magnitude faster for many parsers.
There is a common problem with most of these parser combinator libraries in that they do no state machine optimization whatsoever... with the (sole?) exception of uu-parsinglib.
Applicative parsers, avoiding monadic extensions, readily support optimization and error checking much like flex/bison, Ragel and ANTLR. The cost of running these optimizations once per program execution (not parser evaluation) is fairly minimal and may not be noticeably slower than a precompiled parser.. particularly if the cost is amortized over many parses.
I do wish more of the parser combinator libraries actually did this though. And there are lexx/yacc-like tools for Haskell as well: Alex and Happy (famously used by GHC to parse Haskell source), and Ragel can be bolted in when performance is absolutely critical.