LibGfx: Let FontCascadeList quickly reject out-of-range code points
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run

By keeping track of the enclosing range around all Unicode ranges of a
FontCascadeList entry, we can quickly reject any code point that's
outside all ranges.

This knocks font_for_code_point() from 7% to 3% in the profile when
scrolling on https://screenshotone.com/
This commit is contained in:
Andreas Kling 2025-07-14 17:59:58 +02:00 committed by Alexander Kalenik
commit 0fece0650e
Notes: github-actions[bot] 2025-07-14 22:54:07 +00:00
2 changed files with 24 additions and 4 deletions

View file

@ -40,7 +40,13 @@ public:
struct Entry {
NonnullRefPtr<Font const> font;
Optional<Vector<UnicodeRange>> unicode_ranges;
struct RangeData {
// The enclosing range is the union of all Unicode ranges. Used for fast skipping.
UnicodeRange enclosing_range;
Vector<UnicodeRange> unicode_ranges;
};
Optional<RangeData> range_data;
};
void set_last_resort_font(NonnullRefPtr<Font> font) { m_last_resort_font = move(font); }