Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: cef95678bcc0773f2cf161175e6e5c50d4829783
https://github.com/WebKit/WebKit/commit/cef95678bcc0773f2cf161175e6e5c50d4829783
Author: Ahmad Saleem <[email protected]>
Date: 2026-07-07 (Tue, 07 Jul 2026)
Changed paths:
M Source/WebCore/platform/graphics/WidthIterator.cpp
Log Message:
-----------
[WidthIterator] Avoid redundant Font refcount churn in the per-character
advance loop
https://bugs.webkit.org/show_bug.cgi?id=318771
Reviewed by Brent Fulgham.
WidthIterator::advanceInternal()'s hot loop materialized a fresh
Ref<const Font> from advanceInternalState.nextRangeFont three times per
character (widthForGlyph, GlyphBounds::computeIfNeeded, and
addToGlyphBuffer), each incurring an atomic ref on construction and a
deref on destruction. The font pointer is fixed for the duration of a
loop iteration (it only changes via startNewFontRangeIfNeeded()), so
this is pure overhead.
Bind the font to a single Ref after the default-ignorable early-out and
reuse it. Both computeIfNeeded() and addToGlyphBuffer() take a
const Font&, so the Ref binds by reference with no additional refcount
traffic, reducing the per-character cost from three ref/deref pairs to
one.
No change in behavior.
* Source/WebCore/platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::advanceInternal):
Canonical link: https://commits.webkit.org/316669@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications