Sitelet https://web.archive.org/web/20260625025236/https://github.com/github/codeql/pull/4486
Skip to content

JS: avoid using getFirstToken for sorting#4486

Merged
codeql-ci merged 1 commit into
github:mainfrom
erik-krogh:lessTokens
Oct 21, 2020
Merged

JS: avoid using getFirstToken for sorting#4486
codeql-ci merged 1 commit into
github:mainfrom
erik-krogh:lessTokens

Conversation

@erik-krogh

@erik-krogh erik-krogh commented Oct 15, 2020 •

Copy link
Copy Markdown
Contributor

A while ago a bad join order inspired me to look into getFirstToken and where we use it.
We use it in a few places to sort expression by when they appear in a file.
But it looks like performance is better when we sort by Location instead of getFirstToken.
So I changed the places where we sorted based on getFirstToken.

Here is an evaluation.
(average of three nightly runs, of which one was on my laptop, all evaluations saw a speedup).
Looks like we get a small performance improvement in the neighborhood of 1%.

@github-actions github-actions Bot added the JS label Oct 15, 2020
@erik-krogh erik-krogh marked this pull request as ready for review October 21, 2020 09:42
@erik-krogh erik-krogh requested a review from a team as a code owner October 21, 2020 09:42

@asgerf asgerf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! It makes sense as getFirstToken() is derived from location info anyway.

@codeql-ci codeql-ci merged commit 9faf675 into github:main Oct 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants