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:
parent
c9b4ff3302
commit
0fea3fb731
|
@ -254,7 +254,7 @@ public:
|
||||||
double getTimeEstimate() const override { return .001; }
|
double getTimeEstimate() const override { return .001; }
|
||||||
};
|
};
|
||||||
void action(WriteBuffer& a) {
|
void action(WriteBuffer& a) {
|
||||||
for (auto event : a.events) {
|
for (const auto& event : a.events) {
|
||||||
event.validateFormat();
|
event.validateFormat();
|
||||||
logWriter->write(formatter->formatEvent(event));
|
logWriter->write(formatter->formatEvent(event));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue