Closed sasq64 closed 3 years ago
@sasq64, there isn't. I think the performance depend on not only grammar, but also particular context of source text. The only thing that cpp-peglib checks is to detect left recursive grammar that could cause infinite loop. Is there any good algorithm or tool to benchmark regular expression grammar, so that we could apply it to PEG? Thanks!
I was thinking maybe recording how much the parse has to backtrack, or parse the same bit of source multiple times. I guess I could implement that myself with the trace callbacks ? Then form a histogram on which rules that where evaluated the most...
@sasq64, sounds fantactic! Only thing that I request you is to make sure that no extra performance const should be added when trace callbacks are not set.
@yhirose, I'll close it for now. Please let me know when you work on that.
@sasq64, sounds fantactic! Only thing that I request you is to make sure that no extra performance const should be added when trace callbacks are not set.
Typo: const should be cost.
Is there a way to benchmark your grammar? To see if you have defined rules in a non-optimal way that causes peglib to do unnecessary work ?