Prevent copy of protocol::object on protocol::SerializeObject
commitb0025e414e7b133b2ce5fb638113297b946d2b83
authorRahul Kumar <rahulkmr@meta.com>
Tue, 15 Nov 2022 16:11:16 +0000 (15 08:11 -0800)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Tue, 15 Nov 2022 16:11:16 +0000 (15 08:11 -0800)
tree31b3259f3bcf40206770d13914aebac4a043a05c
parent3975d48e2ae85d46778574b05c030c6952eb3de6
Prevent copy of protocol::object on protocol::SerializeObject

Summary:
Inside protocol::SerializeObject following statement:
  val.objectValue_ref() = obj;
was making a copy of the object. This can be very costly when it is an object corresponding to a large struct. After this change, object serialization time reduced dramatically from 10X slower to 3X slower when compared to schema based serialization.

After perf numbers - https://docs.google.com/spreadsheets/d/1hlxjBt7PCi4tLUZO7NaZt5wBq22h3zi4-GjfbUP2xQU/edit?usp=sharing

Before perf numbers - https://www.internalfb.com/phabricator/paste/view/P549047640?lines=208

Reviewed By: Mizuchi

Differential Revision: D41216856

fbshipit-source-id: b5a79aad882c0318bf2556de27448f030bdd2e68
third-party/thrift/src/thrift/lib/cpp2/protocol/Object.h
third-party/thrift/src/thrift/lib/cpp2/protocol/detail/Object.h