Save a bunch of copies in the trace thread (#7392)

Currently, a std::string is copied unnecessarily for every key and value
in a trace event.

This actually showed up in a jemalloc heap profile while I was
investigating something unrelated. I was surprised to see it since these
allocations should have a very short lifetime.
This commit is contained in:
Andrew Noyes 2022-06-15 12:29:15 -07:00 committed by GitHub
parent c9b4ff3302
commit 0fea3fb731
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -254,7 +254,7 @@ public:
double getTimeEstimate() const override { return .001; }
};
void action(WriteBuffer& a) {
for (auto event : a.events) {
for (const auto& event : a.events) {
event.validateFormat();
logWriter->write(formatter->formatEvent(event));
}