
Use specialised parsers where possible: the provided Skip* parsers can be used when the result of parsing is not required. If consuming a streaming input like a TextReader or an IEnumerable, Try buffers its input to enable backtracking, which can be expensive. This generates a lot of garbage while those objects often won't survive the nursery it's still preferable to avoid allocating them! Query comprehensions are defined by translation into core C# using SelectMany, however, for long queries the translation can allocate a large number of anonymous objects. If you find that parsing is a bottleneck in your code, here are some tips for minimising the runtime of your parser. A carefully written Pidgin parser can be competitive with a hand-written recursive descent parser.
Pidgin is designed to be fast and produce a minimum of garbage.