Closed Rewbert closed 3 years ago
Ah, I had no idea the derived Read instance was so much slower.. sorry for introducing the regression. In that case, we should switch back to megaparsec, but essentially try to replicate the behavior of Read, so that their textual representation is more predictable by human readers.
I just threw together a megaparsec-parser again and got it down to time: 12% space: 19.9% execution time to run the tests: 1 minute and 33 seconds
Profiling the
regression-low
suite shows me that 59% of all time is spent parsing C-output with the derivedRead
instance, and 75% of all memory is allocated at the same time. It seems like maintaining a megaparsec parser is absolutely worth the effort. On my machine these tests takes about 2 minutes and 10 seconds to run.For context: Each test is turned into C, compiled, ran, parsed, interpreted, both traces are compared (and can be up to 10 000 elements long, I think). This happens three times for each test. Still, almost 60% of all time is spent just parsing output with a derived parser.