script: Store DocumentLoader::blocking_loads in a HashSet instead of a Vec - #45974
Merged
Merged
Conversation
Member
|
How many entries could the vector have? |
Contributor
Author
|
Basically every subresource is a blocker such as images and scripts. Amazon for example has 120 at max (and it reduces obviously). |
Contributor
Author
|
@jschwe ping |
DocumentLoader::blocking_loads in a HashSet instead of a Vec
mrobinson
requested changes
Jul 9, 2026
| #[derive(Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)] | ||
| #[derive(Clone, Debug, Eq, Hash, JSTraceable, MallocSizeOf, PartialEq)] | ||
| pub(crate) enum LoadType { | ||
| Image(#[no_trace] ServoUrl), |
Member
There was a problem hiding this comment.
What if two images are loading with the same URL? I think that could cause an issue here. You will need to store a count instead.
Contributor
Author
There was a problem hiding this comment.
Please check if this is how you meant it.
mrobinson
requested changes
Jul 9, 2026
Signed-off-by: Narfinger <[email protected]>
Signed-off-by: Narfinger <[email protected]>
Narfinger
force-pushed
the
document-loader-blocker
branch
from
July 9, 2026 13:39
377ce35 to
a0e08f7
Compare
Signed-off-by: Narfinger <[email protected]>
mrobinson
approved these changes
Jul 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This moves the BlockingLoads from Vector to a HashSet. This saves us roughly 0.3% on a sample run of the script thread execution as previously we had to search through the vector. As the LoadBlockers contain urls we use the std HashSet.
The only change in functionality is that we do not add the same blocker multiple times which could have happened in the previous case. This does not look like part of the design as blockers are removed at the same code point and do not get a handle.
Testing: This does not change observable behavior, so is covered by existing WPT tests.