Skip to content

Provide JSON serialized profiles #69

@hybrist

Description

@hybrist

From the current examples:

const profiler = new Profiler({ sampleInterval: 10, maxBufferSize: 10000 });
const start = performance.now();
for (let i = 0; i < 1000000; i++) {
     doWork();
}
const duration = performance.now() - start;
const trace = await profiler.stop();
const traceJson = JSON.stringify({
  duration,
  trace,
});
sendTrace(traceJson);

While serializing the JSON might be okay for small profiles, it seems risky to encourage it as a general solution. Would it be better to provide the profile as serialized JSON already, potentially removing some blocking work from the main thread? It's not unlikely that those data structures wouldn't have to exist in the JS heap at any point in time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions