Skip to content

layout: get rid of some collect() calls#42327

Merged
mrobinson merged 1 commit intoservo:mainfrom
webbeef:collect-less
Feb 6, 2026
Merged

layout: get rid of some collect() calls#42327
mrobinson merged 1 commit intoservo:mainfrom
webbeef:collect-less

Conversation

@webbeef
Copy link
Copy Markdown
Contributor

@webbeef webbeef commented Feb 4, 2026

Profiling a speedometer run showed significant time spent in some layout function in vector allocations. The main change is to switch the result of query_box_areas() from a Vec to and iterator.

Testing: refactoring with no expected test changes

@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Feb 4, 2026
@Narfinger
Copy link
Copy Markdown
Contributor

Narfinger commented Feb 4, 2026

I did not study the code in detail but should some of these be par_iter() from rayon or depending on the workload par_iter with_min_length?

@webbeef
Copy link
Copy Markdown
Contributor Author

webbeef commented Feb 5, 2026

I did not study the code in detail but should some of these be par_iter() from rayon or depending on the workload par_iter with_min_length

Maybe, but that was not my focus here.

Copy link
Copy Markdown
Member

@mrobinson mrobinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems pretty harmless. Without measurement, I'm not sure these kind of micro-optimizations make sense though. Most of the collecting is probably happening in layout itself which runs more often and deals with more nodes than layout queries. I think a good thing for these kind of optimizations in the future is some actual measurement.

@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Feb 6, 2026
@mrobinson mrobinson added this pull request to the merge queue Feb 6, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Feb 6, 2026
Merged via the queue into servo:main with commit 86403fa Feb 6, 2026
29 checks passed
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants