-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Avoid copying strings when serializing TraceEvent / lock only on buffer operations #52220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This pull request was exported from Phabricator. Differential Revision: D77164969 |
…er operations (facebook#52220) Summary: # Changelog: [Internal] Mainly, 2 changes: 1. `PerformanceTracer::serializeTraceEvent(const TraceEvent& event)` -> `PerformanceTracer::serializeTraceEvent(TraceEvent&& event)` for less copies, actually move strings from the `TraceEvent` into the serialized `folly:object`. 2. When collecting events from the buffer, only lock when accessing buffer, not when serializing. Reviewed By: rubennorte Differential Revision: D77164969
f6ecbf7
to
0efa21d
Compare
…er operations (facebook#52220) Summary: # Changelog: [Internal] Mainly, 2 changes: 1. `PerformanceTracer::serializeTraceEvent(const TraceEvent& event)` -> `PerformanceTracer::serializeTraceEvent(TraceEvent&& event)` for less copies, actually move strings from the `TraceEvent` into the serialized `folly:object`. 2. When collecting events from the buffer, only lock when accessing buffer, not when serializing. Reviewed By: rubennorte Differential Revision: D77164969
This pull request was exported from Phabricator. Differential Revision: D77164969 |
2 similar comments
This pull request was exported from Phabricator. Differential Revision: D77164969 |
This pull request was exported from Phabricator. Differential Revision: D77164969 |
…er operations (facebook#52220) Summary: Pull Request resolved: facebook#52220 # Changelog: [Internal] Mainly, 2 changes: 1. `PerformanceTracer::serializeTraceEvent(const TraceEvent& event)` -> `PerformanceTracer::serializeTraceEvent(TraceEvent&& event)` for less copies, actually move strings from the `TraceEvent` into the serialized `folly:object`. 2. When collecting events from the buffer, only lock when accessing buffer, not when serializing. Reviewed By: rubennorte Differential Revision: D77164969
…er operations (facebook#52220) Summary: # Changelog: [Internal] Mainly, 2 changes: 1. `PerformanceTracer::serializeTraceEvent(const TraceEvent& event)` -> `PerformanceTracer::serializeTraceEvent(TraceEvent&& event)` for less copies, actually move strings from the `TraceEvent` into the serialized `folly:object`. 2. When collecting events from the buffer, only lock when accessing buffer, not when serializing. Reviewed By: rubennorte Differential Revision: D77164969
This pull request was exported from Phabricator. Differential Revision: D77164969 |
1 similar comment
This pull request was exported from Phabricator. Differential Revision: D77164969 |
…er operations (facebook#52220) Summary: Pull Request resolved: facebook#52220 # Changelog: [Internal] Mainly, 2 changes: 1. `PerformanceTracer::serializeTraceEvent(const TraceEvent& event)` -> `PerformanceTracer::serializeTraceEvent(TraceEvent&& event)` for less copies, actually move strings from the `TraceEvent` into the serialized `folly:object`. 2. When collecting events from the buffer, only lock when accessing buffer, not when serializing. Reviewed By: rubennorte Differential Revision: D77164969
Summary: # Changelog: [Internal] - `bool tracing_` -> `std::atomic<bool> tracingAtomic_`. - More doc-comments to explain the usage of mutex and atomics. - `PerformanceTracer::isTracing()` -> `inline PerformanceTracer::isTracing()`. - `uint64_t processId_` -> `const uint64_t processId_`. The main change is that the boolean flag that controls "if we are tracing" is now atomic, which should eliminate potential data races. To avoid "logic" races, we are still going to lock mutex, and then check again. The use of `std::atomic` allows us to perform cheaper check first to avoid potentially unnecessary serializations from other systems that report events into `PerformanceTracer`. Reviewed By: rubennorte Differential Revision: D77053030
Summary: # Changelog: [Internal] `buffer_.push_back` -> `buffer_.emplace_back` I didn't measure if there were any runtime wins from this, because I don't expect there would be. Let's avoid potential copies, if possible. Reviewed By: rubennorte Differential Revision: D77053032
…2196) Summary: # Changelog: [Internal] Probably been overlooked for quite some time, but shouldn't be a bottleneck. Reviewed By: motiz88 Differential Revision: D77148271
…er operations (facebook#52220) Summary: # Changelog: [Internal] Mainly, 2 changes: 1. `PerformanceTracer::serializeTraceEvent(const TraceEvent& event)` -> `PerformanceTracer::serializeTraceEvent(TraceEvent&& event)` for less copies, actually move strings from the `TraceEvent` into the serialized `folly:object`. 2. When collecting events from the buffer, only lock when accessing buffer, not when serializing. Reviewed By: rubennorte Differential Revision: D77164969
This pull request was exported from Phabricator. Differential Revision: D77164969 |
This pull request has been merged in ca647c1. |
Summary:
Changelog: [Internal]
Mainly, 2 changes:
PerformanceTracer::serializeTraceEvent(const TraceEvent& event)
->PerformanceTracer::serializeTraceEvent(TraceEvent&& event)
for less copies, actually move strings from theTraceEvent
into the serializedfolly:object
.Differential Revision: D77164969