1

The title says it all: I look for examples or tutorial for Zepto parser in attoparsec.

I have a reasonably simple parser for a network protocol (BGP, as it happens), which runs reasonably quickly, but still significantly slower than 'C'. I've inlined, unboxed and benchmarked as well as I can, and now wonder whether there is anything more I can gain using the Zepto parser variant which my problem seems quite appropriate to.

hdb3
  • 239
  • 1
  • 10

1 Answers1

3

Here is an example of Redis protocol parser using Zepto.

Note that attoparsec allows unbounded backtracking, it makes it inefficient for parsers that don't use backtracking. So moving to Zepto makes sense. You may want to evaluate also scanner and binary-parsers packages if you don't need backtracking, they may (or may not) be up to 3 times faster then attoparsec.

Yuras
  • 13,856
  • 1
  • 45
  • 58
  • These pointers are very useful. Supplementary question: for each of scanner, zepto and binary-parser, must i re-implement the word16 and word32 primitives? Zepto does not even provide word8 operation, so it might not be obvious how to do this. Scanner has word8 so extending is likely not so hard. Its not clear if binary-parser allows you to simply use existing Binary functions (but I guess the answer is YES)? – hdb3 Jul 17 '19 at 22:18