Skip to content

Commit c77e94d

Browse files
authored
Optimize ValType parsing in wast (#2365)
* Optimize `ValType` parsing in `wast` Fuzzing timed out recently with a test case and some profiling showed that parsing types was an alarmingly large amount of the profile. This commit optimizes the parsing of `ValType` by avoiding the use of `Lookahead1` for example and the general style of recursive-descent parsing. Recursive descent parsing performs well when there's not a big branch of what to parse next, but in the case of `ValType` there's a lot of possible branches which meant that the prior idioms ended up generating a pretty slow parser. With this commit the fuzz-generated test case parses 3x faster, dropping from ~1s to 300ms. Still not great, but hopefully fast enough for the fuzzer. * Fix clippy warnings
1 parent b1d8ff5 commit c77e94d

File tree

2 files changed

+145
-152
lines changed

2 files changed

+145
-152
lines changed

0 commit comments

Comments
 (0)