-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a performance bug in BinaryOperatorExpression.span (#569)
Previously, evaluator called BinaryOperationExpression.span for each binary operation it evaluated, which in turn called spanForList() to create a span covering both child expressions. spanForList() then called .span for both the left and right child operations *twice*, leading to exponential behavior. This is now avoided in three complementary ways: 1. The evaluator avoids eagerly calling AstNode.span, instead keeping the original AstNode until the span itself needs to be accessed. This means that a span will only be accessed when an error actually occurs, and then only one operation's span will be accessed. 2. BinaryOperationExpression.span now iterates through any child operations before calling their .span methods, so it only performs O(1) allocations. 3. spanForList() now only calls each AstNode.span once.
- Loading branch information
Showing
8 changed files
with
453 additions
and
296 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
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
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.