[webkit-changes] [WebKit/WebKit] cf81ca: Micro-optimize Path IPC serialization / deserializ...
Chris Dumez
noreply at github.com
Fri Jun 16 16:52:10 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: cf81ca21f2828619acff44933c6515551b50c3be
https://github.com/WebKit/WebKit/commit/cf81ca21f2828619acff44933c6515551b50c3be
Author: Chris Dumez <cdumez at apple.com>
Date: 2023-06-16 (Fri, 16 Jun 2023)
Changed paths:
M Source/WebCore/platform/graphics/Path.cpp
M Source/WebCore/platform/graphics/Path.h
M Source/WebCore/platform/graphics/cairo/PathCairo.cpp
M Source/WebCore/platform/graphics/cg/PathCG.cpp
M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
Log Message:
-----------
Micro-optimize Path IPC serialization / deserialization
https://bugs.webkit.org/show_bug.cgi?id=258220
Reviewed by Wenson Hsieh.
Micro-optimize Path IPC serialization / deserialization:
1. The IPC encoder was first serializing inline data and falling back
to calling apply() if the data isn't inline. However, apply() would
check again for various types on inline data before calling
applySlowCase() for the non-inline data. To optimize this, I renamed
applySlowCase() to applyIgnoringInlineData() and call it directly
from the IPC encoder.
2. To detect the end of the path during IPC deserialization, the decoder
relied on serializing the type of each path Element as a
std::optional<PathElementType> and we would know we reached the end
when decoding std::nullopt. This was a bit inefficient was it would
encode first a boolean (std::optional is set or not) and then a
uint8_t (actual enum value) for each path Element. To optimize this,
we now encode the end of the path as an enum value so that we only
ending a uint8_t for each path element type.
* Source/WebCore/platform/graphics/Path.cpp:
(WebCore::Path::apply const):
* Source/WebCore/platform/graphics/Path.h:
(WebCore::Path::encode const):
(WebCore::Path::decode):
(WebCore::EncodedPathElementType::EncodedPathElementType): Deleted.
(WebCore::EncodedPathElementType::isEndOfPath const): Deleted.
(WebCore::EncodedPathElementType::isValidPathElementType const): Deleted.
(WebCore::EncodedPathElementType::type const): Deleted.
* Source/WebCore/platform/graphics/cairo/PathCairo.cpp:
(WebCore::Path::applyIgnoringInlineData const):
(WebCore::Path::applySlowCase const): Deleted.
* Source/WebCore/platform/graphics/cg/PathCG.cpp:
(WebCore::Path::applyIgnoringInlineData const):
(WebCore::Path::applySlowCase const): Deleted.
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
Canonical link: https://commits.webkit.org/265260@main
More information about the webkit-changes
mailing list