Skip to content
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

perf: use fixed-size arrays for the font cache #40898

Merged

Conversation

ckerr
Copy link
Member

@ckerr ckerr commented Jan 5, 2024

Description of Change

font_defaults.cc holds a private cache of default fonts for [font family, script] combos. The cache is currently implemented with nested std::unordered_maps; but since we know at compile time which families and scripts we want to cache, we can hold it in statically-allocated arrays instead.

All reviews welcomed. CC @nornagon who originally wrote font_defaults.cc in #15486 and @dsanders11 who most recently touched the code

Checklist

Release Notes

Notes: none

Since we know at compile time which [family x script] combos we want to
cache, we can hold the cache in fixed std::arrays instead of in nested
std::unordered_maps.
@ckerr ckerr added the target/29-x-y PR should also be added to the "29-x-y" branch. label Jan 5, 2024
@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Jan 5, 2024
@VerteDinde VerteDinde added the semver/patch backwards-compatible bug fixes label Jan 7, 2024
@electron-cation electron-cation bot added new-pr 🌱 PR opened in the last 24 hours and removed new-pr 🌱 PR opened in the last 24 hours labels Jan 7, 2024
@codebytere codebytere merged commit 7b4d490 into main Jan 8, 2024
24 checks passed
@codebytere codebytere deleted the refactor/use-fixed-size-array-for-font-defaults-cache branch January 8, 2024 09:31
Copy link

release-clerk bot commented Jan 8, 2024

No Release Notes

@trop
Copy link
Contributor

trop bot commented Jan 8, 2024

I have automatically backported this PR to "29-x-y", please check out #40912

@trop trop bot added in-flight/29-x-y merged/29-x-y PR was merged to the "29-x-y" branch. and removed target/29-x-y PR should also be added to the "29-x-y" branch. in-flight/29-x-y labels Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged/29-x-y PR was merged to the "29-x-y" branch. semver/patch backwards-compatible bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants