fparsec icon indicating copy to clipboard operation
fparsec copied to clipboard

Will the slowness warning of computation expressions be moot after f#5?

Open travis-leith opened this issue 3 years ago • 1 comments

The documents warn us that using computation expressions will be slower than we might expect.

The upcoming release of F#5 is adding support for applicatives in computation expressions. Will this slowness still be an issue if we use the new applicative syntax, provided FParsec provides support for it?

travis-leith avatar Sep 05 '20 12:09 travis-leith

Adding support for applicatives can definitely address some of the underlying concerns, as instead of nested calls to Bind, independent parsers can be run individually and collected up into a single value for passing to the next Bind call via MergeSources and/or BindN/BindReturn overloads.

There will likely be some additional overhead still compared to manual parser writing, but I would naïevely expect the performance gap to shrink massively.

And perhaps with state machine additions coming sometime in the future the parse CE could actually compile down to low/zero-overhead state machines.

baronfel avatar Dec 05 '20 15:12 baronfel