-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test case for latest fuzzer timeout issue and fix the pathologica…
…l performance (#343) The pathological test case was taking ~10 seconds (!!). Now it's just 200ms. The issue was that it was relying on `ast.FileInfo` to provide things like the line numbers for tokens. But those are all computed on-demand. They require allocations, a O(log n) search through line-ending offsets (n is number of lines in file), then an O(n) scan to compute column (n is length of line). This operation was being done frequently enough that it induced pathologically bad performance. So now we have just a _little_ bit more book-keeping in the lexer, so that we can decide when to donate a comment to prior token as a trailing comment without having to ask the file info to compute these things.
- Loading branch information
Showing
3 changed files
with
83 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.