Optimize transferables duplicate detection with Set for O(1) lookups#74635
Conversation
Co-authored-by: adamsilverstein <2676022+adamsilverstein@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @Copilot. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
2bc9089
into
feature/74352-new-wordpress-vips-package-no-shopify
…74635) * Initial plan * Optimize transferables duplicate detection using Set Co-authored-by: adamsilverstein <2676022+adamsilverstein@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: adamsilverstein <2676022+adamsilverstein@users.noreply.github.com>
…74635) * Initial plan * Optimize transferables duplicate detection using Set Co-authored-by: adamsilverstein <2676022+adamsilverstein@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: adamsilverstein <2676022+adamsilverstein@users.noreply.github.com>
…ordPress#74635) * Initial plan * Optimize transferables duplicate detection using Set Co-authored-by: adamsilverstein <2676022+adamsilverstein@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: adamsilverstein <2676022+adamsilverstein@users.noreply.github.com>
…ordPress#74635) * Initial plan * Optimize transferables duplicate detection using Set Co-authored-by: adamsilverstein <2676022+adamsilverstein@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: adamsilverstein <2676022+adamsilverstein@users.noreply.github.com>
The
findTransferablesfunction used.includes()for duplicate detection, resulting in O(n²) complexity when processing many transferable objects.Changes
transferableSetfor O(1) duplicate lookups alongside the result array.includes()calls with.has()checks on lines 24, 36, 48, 60, 72, 84, 96, and 114Example
Behavior remains identical. Performance improvement is most significant when transferring large numbers of ArrayBuffers, TypedArrays, or other transferable objects in worker messages.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.