JavaScript: Fix InconsistentNew performance regression.
#603
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As noted by Alex ET, this query has significantly regressed in performance from 1.18 on
rhino. I can't immediately see any query or library changes that would have caused it, but it's not difficult to fix by refactoring the query; see first commit.Looking at the results on
rhino, I then noticed that the query was producing a humongous number of result links since it listed all calls to the function withnewand all without, ballooning 17 alerts onrhinointo >80K result tuples. The second commit fixes this by only showing one call withnewand one without, picking the first one when sorted lexicographically by file name, line and column.Comparing three versions of the query (before this PR, after the first commit, and after the second commit) shows no changes in alerts, and reasonable performance (internal link). Note that the table shows only the runtimes for the query itself, but I ran
definitions.qlbefore to warm the cache. While some projects exhibit a slowdown of ten seconds or more, these are outliers, and worth the improved quality of results, I think.Since this is a regression from 1.18, I'm proposing this as a hotfix.