-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
chore: bit of code cleanup #10218
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
chore: bit of code cleanup #10218
Conversation
|
@@ -379,13 +379,15 @@ function execute_signal_fn(signal) { | |||
// If we have more than 16 elements in the array then use a Set for faster performance | |||
// TODO: evaluate if we should always just use a Set or not here? | |||
const full_current_dependencies_set = | |||
current_dep_length > 16 ? new Set(full_current_dependencies) : null; | |||
current_dep_length > 16 && deps_length - current_dependencies_index > 1 |
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.
additional perf optimization
full_current_dependencies_set !== null | ||
? !full_current_dependencies_set.has(dependency) | ||
: !full_current_dependencies.includes(dependency) |
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 always ran both when the dependency wasn't in the set previously, slowing things down.
I don't know if this was profiled, but if it was and it didn't appear that this was slower, I'm wondering if this kind of perf optimization is worth it in general
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.
Nice catch! I guess we didn't ever get the Set that much, so it wasn't as obvious.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
leftovers from #10213
Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.Tests and linting
pnpm test
and lint the project withpnpm lint