Skip to content

Commit

Permalink
Fix a super subtle bug: we were strlen'ing the entire buffer every time
Browse files Browse the repository at this point in the history
we returned an lp_ keyword, which is N^2 work with a very large N
(particularly when your testcase is half a megabyte of .fir)!

This speeds up the parser from 12.75s -> 0.09s (!!!), which feels better
to me :)
  • Loading branch information
lattner committed Apr 8, 2020
1 parent e355599 commit 2c987c3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Dialect/FIRRTL/FIRToMLIR/FIRLexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ FIRToken FIRLexer::lexIdentifierOrKeyword(const char *tokStart) {
.Default(FIRToken::identifier);
if (kind != FIRToken::identifier) {
++curPtr;
return FIRToken(kind, tokStart);
return formToken(kind, tokStart);
}
}

Expand Down

0 comments on commit 2c987c3

Please sign in to comment.