ssm-lang / Scoria

This is an embedding of the Sparse Synchronous Model, in Haskell!
BSD 3-Clause "New" or "Revised" License
4 stars 0 forks source link

Profile interpreter to see if it's the culprit that makes the tests take longer than previously #58

Closed Rewbert closed 2 years ago

Rewbert commented 2 years ago

Profiling the regression-low suite shows me that 59% of all time is spent parsing C-output with the derived Read 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.

j-hui commented 2 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.

Rewbert commented 2 years ago

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