Reduce arena allocation overhead in MutationRef deep-copy constructors
Description
MutationRef deep-copy construction currently performs two independent arena allocations per mutation when copying payload data, even though both payloads belong to the same mutation object and are always constructed together.
This introduces unnecessary/extra allocator overhead in hot paths involving large numbers of mutation constructions, particularly for workloads dominated by small-to-medium mutation payloads.
Root Cause
In fdbclient/include/fdbclient/CommitTransaction.h, the deep-copy constructors currently copy param1 and param2 independently:
MutationRef(Arena& to, Type t, StringRef a, StringRef b)
: type(t), param1(to, a), param2(to, b), corrupted(false) {}
MutationRef(Arena& to, const MutationRef& from)
: type(from.type), param1(to, from.param1), param2(to, from.param2), corrupted(false) {}
Each StringRef(Arena&, ...) construction performs its own arena allocation. As a result, every deep-copied mutation performs two separate arena allocations.
This affects hot paths such as:
VectorRef<MutationRef>::emplace_back_deepVectorRef<MutationRef>::push_back_deep- commit batching
Proposed Solution
Reduce the number of arena allocations performed during MutationRef deep-copy construction by storing copied mutation payload data more efficiently within the arena allocation path, while preserving existing StringRef ownership behavior.