[webkit-changes] [WebKit/WebKit] 42948c: Reduce calls to LayoutUnit and use default constru...
Ahmad Saleem
noreply at github.com
Sat Jan 21 15:42:48 PST 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 42948cd0674a44230185146a56461d957488da8a
https://github.com/WebKit/WebKit/commit/42948cd0674a44230185146a56461d957488da8a
Author: Ahmad Saleem <ahmad.saleem792+github at gmail.com>
Date: 2023-01-21 (Sat, 21 Jan 2023)
Changed paths:
M Source/WebCore/platform/graphics/LayoutPoint.h
M Source/WebCore/platform/graphics/LayoutSize.h
Log Message:
-----------
Reduce calls to LayoutUnit and use default constructors for containers
Reduce calls to LayoutUnit and use default constructors for containers
https://bugs.webkit.org/show_bug.cgi?id=250884
Reviewed by Alan Baradlay.
Merge (except RenderBox.h) - https://src.chromium.org/viewvc/blink?view=revision&revision=158483 &
https://src.chromium.org/viewvc/blink?view=rev&revision=158571
LayoutUnit() is fast; LayoutUnit(int) is slow because of bounds-checks.
Since the default constructor sets the m_value of the LayoutUnit to 0,
we can replace calls to LayoutUnit(0) with the default constructor.
The integer constructor of LayoutUnit is relatively quite expensive;
the default constructor is a far cheaper way to initialize a LayoutUnit
with the value of 0.
Implicit conversions from int to LayoutUnit mean that tests against 0
are also surprisingly expensive.
* Source/WebCore/platform/graphics/LayoutPoint.h: Modify 'LayoutPoint()' to default constructor
* Source/WebCore/platform/graphics/LayoutSize.h:
(1) Modify 'LayoutPoint()' to default constructor
(2) bool 'isEmpty' to return values with "rawValues()"
Canonical link: https://commits.webkit.org/259177@main
More information about the webkit-changes
mailing list