Skip to content

fonts: Small optimization in WebFont download handler - #46528

Merged
TimvdLippe merged 1 commit into
servo:mainfrom
Narfinger:font-fxhash
Jul 16, 2026
Merged

fonts: Small optimization in WebFont download handler#46528
TimvdLippe merged 1 commit into
servo:mainfrom
Narfinger:font-fxhash

Conversation

@Narfinger

@Narfinger Narfinger commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

This makes some small optimization in the webfont download handler.

  • Switch local_fonts in WebFontDownloadState to use a FxHashMap as the key is atoms.
  • On construction of the local_fonts hashmap is now from_iter instead of manually adding them. This allows preallocation and one less clone.

This changes the behaviour as from_iter does not guarantee which font will return while the previous code always inserted the last font.

Testing: If we rely on this behavior WPT should catch the change in functionality. Test run here https://github.com/Narfinger/servo/actions/runs/29414515281

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
@Narfinger
Narfinger marked this pull request as ready for review July 15, 2026 13:19
@Narfinger
Narfinger requested a review from nicoburns as a code owner July 15, 2026 13:19
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jul 15, 2026
@TimvdLippe
TimvdLippe added this pull request to the merge queue Jul 16, 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 Jul 16, 2026
Merged via the queue into servo:main with commit dbd57e7 Jul 16, 2026
35 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 Jul 16, 2026
@Narfinger
Narfinger deleted the font-fxhash branch July 16, 2026 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-review There is new code that needs to be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants