-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
perf(es/lints): Avoid needless allocations in no-dupe-args
#9041
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swc-bump:
- swc_ecma_lints
- swc_ecma_utils
- swc_core
/// This has time complexity of O(n^2), but it's fine as the number of paramters | ||
/// is usually small. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably holds true for 99.9%, but maybe we can add another implementation that is used for n > 100 based on a hashmap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Automated review comment generated by auto-rebase script
.struct_span_err( | ||
id2.span, | ||
&format!( | ||
"the name `{}` is bound more than once in this parameter list", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a binding is defined 3 times this error will be reported multiple times. That was already the case with the old implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's handled by done
. Actually I added done
just to match the original behavior.
Description:
I introduced a zero-allocation variant for
swc_ecma_utils::DestructuringFinder
that does not allocate anything.Related issue (if exists):