Closed ipmcc closed 10 years ago
PEGKit is a recursive descent parser and the design is entirely based on the use of exceptions to do flow control in deeply nested structures. This will not change. The string formatting is more of a serious issue, but it seems like that is fairly easy for you to customize.
Title says it all; Profiling a relatively simple parser generated by PEGKit/ParserGenApp shows that it spends about ~42% of its time doing exception processing. Even after removing all the string formatting of the exception messages, it's still spending ~25% of its time in
obc_exception_throw.
I can imagine why it was done this way -- exceptions provide an easy way to unwind arbitrarily deep call stacks, which I suspect is a significant benefit/short cut in the context of a recursive descent parser -- but the performance impact is pretty significant.