Skip to content

Commit 29a8758

Browse files
thedavekwonfacebook-github-bot
authored andcommitted
DynamicPatch::toPatch perf improvement
Summary: * move type instead of copy * use DynamicPatch::encode which is our new API that conditionally directly serialize. Reviewed By: iahs Differential Revision: D73065606 fbshipit-source-id: 7ad10635f6685a8ce797f18a8399aabd18352d49
1 parent e4a2a02 commit 29a8758

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

thrift/lib/thrift/detail/DynamicPatch.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1998,13 +1998,13 @@ DynamicPatch::~DynamicPatch() = default;
19981998
type::AnyStruct DynamicPatch::toPatch(type::Type type) const {
19991999
type::AnyStruct any;
20002000
any.protocol() = type::StandardProtocol::Compact;
2001-
any.data() = *protocol::serializeObject<CompactProtocolWriter>(toObject());
2002-
any.type() = toPatchType(type);
2001+
any.data() = *encode<CompactProtocolWriter>();
2002+
any.type() = toPatchType(std::move(type));
20032003
return any;
20042004
}
20052005

20062006
void DynamicPatch::fromPatch(const type::AnyStruct& any) {
2007-
auto v = protocol::detail::parseValueFromAny(any);
2007+
auto v = protocol::parseValueFromAny(any);
20082008
fromObject(std::move(v.as_object()));
20092009
}
20102010

0 commit comments

Comments
 (0)