Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(linter): eslint/no-loss-of-precision #649

Merged
merged 5 commits into from
Jul 28, 2023

Conversation

Devin-Yeung
Copy link
Contributor

Close #613

@CLAassistant
Copy link

CLAassistant commented Jul 28, 2023

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added the A-linter Area - Linter label Jul 28, 2023
Copy link
Member

@Boshen Boshen left a comment

Choose a reason for hiding this comment

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

This rule can be slow due to all the allocations, we may need to add a bunch of Cow to reduce some allocations.

@Devin-Yeung
Copy link
Contributor Author

Some minor fixes are done, I will try my best to reduce the number of string allocations to improve the performance

@Devin-Yeung
Copy link
Contributor Author

I am not familiar with Cow, so I may misuse some APIs, any advice is appreciated 🙇‍♂️

@Boshen Boshen merged commit 72afdf6 into oxc-project:main Jul 28, 2023
17 checks passed
@DonIsaac DonIsaac added the first-pr A contributor's first PR label Jul 28, 2023
@Devin-Yeung Devin-Yeung deleted the no-loss-of-precision branch August 10, 2023 09:15
@Boshen
Copy link
Member

Boshen commented Aug 21, 2023

@Devin-Yeung This rule is currently the slowest, twice as slow compared to all the others rules. Are you intrested in doing some performance work for this rule?

@Boshen
Copy link
Member

Boshen commented Aug 21, 2023

image

Timing from 52k files.

@Devin-Yeung
Copy link
Contributor Author

@Devin-Yeung This rule is currently the slowest, twice as slow compared to all the others rules. Are you intrested in doing some performance work for this rule?

It seems that the regex call is very expensive, maybe we can parse the number manually to get better performance. But unfortunately I haven't had much time to be able to deal with this lately😢. Should we consider opening an issue to invite anyone interested to collaborate on this?

@Boshen
Copy link
Member

Boshen commented Aug 21, 2023

@Devin-Yeung This rule is currently the slowest, twice as slow compared to all the others rules. Are you intrested in doing some performance work for this rule?

It seems that the regex call is very expensive, maybe we can parse the number manually to get better performance. But unfortunately I haven't had much time to be able to deal with this lately😢. Should we consider opening an issue to invite anyone interested to collaborate on this?

I'll create a first good issue when we have found a viable solution, otherwise it may waste people's time :-(

@Devin-Yeung
Copy link
Contributor Author

I'll create a first good issue when we have found a viable solution, otherwise it may waste people's time :-(

Agreed, I'm also not sure how much of a performance gain manual parsing would bring about 🤔

@Maneren
Copy link
Contributor

Maneren commented Aug 22, 2023

Agreed, I'm also not sure how much of a performance gain manual parsing would bring about 🤔

Around 1.5-2x speedup of the rule on my machine on babel and typescript codebases, bringing it to times similar to the other slow rules. I'll clean up the code and send a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linter Area - Linter first-pr A contributor's first PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(linter): eslint/no-loss-of-precision
5 participants