Avoid constructing ProfilerMarkerPayloads when adding markers
Categories
(Core :: Gecko Profiler, task, P3)
Tracking
()
People
(Reporter: mozbugz, Assigned: mozbugz)
References
Details
Since bug 1576555, I believe all ProfilerMarkerPayload
s are created on the stack as temporary objects, and are passed by reference-to-const to profiler_add_marker()
, mostly through PROFILER_ADD_MARKER_WITH_PAYLOAD
:
https://searchfox.org/mozilla-central/rev/fa52bedc4b401c12251513fa1c9df1753a29abb2/tools/profiler/public/GeckoProfiler.h#809-816
The payload is then serialized roughly member-by-member into the main profile buffer, this is done through virtual ProfilerMarkerPayload
functions.
It should be possible to avoid this temporary object, and pass the callers arguments straight into a static type-specific serialization code.
Before going too far, we should confirm that the payload is actually created on the stack -- in case the compiler is clever enough to see that the object is only a temporary storage for the caller's arguments, in which case there's no need to go further.
Then I think the solution will be to somehow combine the payload constructor and the serialization functions, into a static serialization function that takes all arguments.
(See bug 1578792 about BackTraces, we may want to think about it at the same time, to possibly do the work during profiler_add_marker
, and try to avoid its memory allocations if possible.)
Assignee | ||
Comment 1•4 years ago
|
||
There are no more marker payloads. I'll call it fixed thanks to bug 1646266.
Description
•