Closed Bug 1648357 Opened 4 years ago Closed 2 years ago

Move Base Profiler data to Gecko Profiler instead of copying it twice

Categories

(Core :: Gecko Profiler, task, P3)

task

Tracking

()

RESOLVED WONTFIX

People

(Reporter: mozbugz, Unassigned)

References

(Blocks 1 open bug)

Details

Currently when the Gecko Profiler (GP) starts, it calls the Base Profiler's (BP) profiler_get_profile(), stores the string and writes it into the final profile.
In more details:

  1. BP creates a SpliceableChunkedJSONWriter, which creates a ChunkedJSONWriteFunc.
  2. BP converts its internal buffer into JSON, in the SpliceableChunkedJSONWriter (creating a number of UniquePtr<char[]> buffers).
  3. BP converts copies the JSON buffers into a single UniquePtr<char[]> string.
  4. GP takes ownership of the string.
  5. Later, when capturing: GP creates its own SpliceableChunkedJSONWriter and stores its JSON data.
  6. GP writes the BP string with the JSON writer.

So we copy the whole BP data twice, at steps 3 and 6.
On slow machines, step 3 can take a few seconds.
Some measurements on Try showed that step 6 can take a full second to operate!

But since both profilers are using a SpliceableChunkedJSONWriter, it should be possible to keep the BP one as-is (or at least its list of buffers), and later splice it into the GP's. The two full-string copies become moving a vector-of-buffers, which is effectively copying a small number of pointers.

Instead of trying to move the Base Profiler data more efficiently, bug 1753192 will simply not copy/move anything! (There will only be one buffer, usable by both Base and Gecko Profilers.)

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.