firefox-devtools / firefox-devtools/profiler

Investigate if we can improve the performance of `pq profile info`

Open
#6,181 0 comments 0 reactions 0 assignees View on GitHub
cli perf
Dominant language
TypeScript
Stars
1.5k
Forks
491
Avg merge
3d 5h
Merged PRs (30d)
30

Description

I had a profile today that I was using as an example and realized that `pq profile info` command takes around ~24 seconds! I captured a cpuprofile of that command (with non-minified bundle for proper frames): https://share.firefox.dev/4pn4p0k

It looks like we are spending ~15 seconds inside `addIndexIntervalsExceedingThreshold` which is called by `getSlices`.
Apart from that I see ~4.5 seconds in `combineCPUDataFromThreads`.

I assume that's because we combine all the threads and then iterate over that large data. I don't know if we can make that part faster yet, but it would be good to investigate further at least.

Note that I can't share that example profile here as it was shared by someone else privately. But I assume a generic large profile with a lot of threads would result in a similar issue. I'll try to capture a profile like that and share later.

┆Issue is synchronized with this [Jira Task](https://mozilla-hub.atlassian.net/browse/FP-1363)

Contributor guide

Open the contributing guide

Research direction

Start by profiling a generic large profile with many threads using `pq profile info`, then inspect `getSlices`, especially `addIndexIntervalsExceedingThreshold`, and `combineCPUDataFromThreads`. Compare the captured timings with the linked CPU profile. Done means identifying the main bottleneck and documenting or implementing a measurable performance improvement.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.