diff options
author | Thomas Lively <tlively@google.com> | 2024-04-18 17:08:20 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-18 17:08:20 -0700 |
commit | 4a907b0a5ec1c25eef259ba54b387865edbe0451 (patch) | |
tree | 86f86fee1fabf884ac6ca50da59caa9caea604b1 /src/parser/lexer.cpp | |
parent | d39b4fa0df1115bf4ba253814ac2c58258aab3b2 (diff) | |
download | binaryen-4a907b0a5ec1c25eef259ba54b387865edbe0451.tar.gz binaryen-4a907b0a5ec1c25eef259ba54b387865edbe0451.tar.bz2 binaryen-4a907b0a5ec1c25eef259ba54b387865edbe0451.zip |
[Parser][NFC] Solve performance issue by adding maybeLabelidx (#6514)
Creating an error in the parser is an extremely expensive operation for very
large files because it has to traverse the input buffer and count newlines to
compute the error message. Despite that, there are a few places were we create
errors just to discard them and continue parsing. The most notable of these
places was where we parsed the list of label index immediates for the br_table
instruction. The parser determined the end of the list by intercepting the error
produced when trying to parse one more label index.
Fix this significant performance problem causing parsing to be quadratic by
introducing and using `maybeLabelidx`, which tries to parse a label index but
does not produce an error if it fails.
Diffstat (limited to 'src/parser/lexer.cpp')
0 files changed, 0 insertions, 0 deletions