commit 2a1d70136b8cdd09919940f398782660742b7236
parent 0249c61fb8c99c6607e14d1d2442d85f5aaad587
Author: Jonathan Kew <jkew@mozilla.com>
Date: Thu, 2 Oct 2025 10:02:01 +0000
Bug 1991943 - Use memset() to initialize spacing array to zero. r=layout-reviewers,emilio,TYLin
This is a trivial change that won't meaningfully move the perf needle,
but in theory the compiler might do something better with memset() than
the explicit loop over the buffer, explicitly assigning each element.
Differential Revision: https://phabricator.services.mozilla.com/D267049
Diffstat:
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp
@@ -4059,11 +4059,7 @@ void nsTextFrame::PropertyProvider::GetSpacingInternal(Range aRange,
bool aIgnoreTabs) const {
MOZ_ASSERT(IsInBounds(mStart, mLength, aRange), "Range out of bounds");
- uint32_t index;
- for (index = 0; index < aRange.Length(); ++index) {
- aSpacing[index].mBefore = 0.0;
- aSpacing[index].mAfter = 0.0;
- }
+ std::memset(aSpacing, 0, aRange.Length() * sizeof(*aSpacing));
if (mFrame->Style()->IsTextCombined()) {
return;