-
-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
? new Set(full_current_dependencies) | ||
: null; | ||
for (i = current_dependencies_index; i < deps_length; i++) { | ||
const dependency = dependencies[i]; | ||
if ( | ||
(full_current_dependencies_set !== null && | ||
!full_current_dependencies_set.has(dependency)) || | ||
!full_current_dependencies.includes(dependency) | ||
full_current_dependencies_set !== null | ||
? !full_current_dependencies_set.has(dependency) | ||
: !full_current_dependencies.includes(dependency) | ||
Comment on lines
+388
to
+390
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
) { | ||
remove_consumer(signal, dependency); | ||
} | ||
|
@@ -1084,7 +1086,7 @@ function mark_subtree_children_inert(signal, inert, visited_blocks) { | |
for (i = 0; i < references.length; i++) { | ||
const reference = references[i]; | ||
if ((reference.f & IS_EFFECT) !== 0) { | ||
mark_subtree_inert(references[i], inert, visited_blocks); | ||
mark_subtree_inert(reference, inert, visited_blocks); | ||
} | ||
} | ||
} | ||
|
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