Skip to content
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

Improve flamegraph rendering performance #3661

Merged
merged 8 commits into from
Aug 23, 2023
Merged

Improve flamegraph rendering performance #3661

merged 8 commits into from
Aug 23, 2023

Conversation

brancz
Copy link
Member

@brancz brancz commented Aug 22, 2023

With these changes we can render ~800k unique stacks within ~2s. There's still more that can be done, but I felt like this would be a good check in.

All these changes have already been verified to be working as expected by running them on Polar Signals Cloud for some time.

In some benchmarks this has a huge improvement:

```
$ benchstat -delta-test=none old.txt new.txt
name                old time/op  new time/op  delta
ArrowFlamegraph-10    147s ± 0%    105s ± 0%  -28.38%
```
Profiling data showed that the "map" access and iteration resulted in
large amounts of CPU usage.
Profiling data showed that allocating these slices new all the time is
very expensive: https://pprof.me/5bf3731
Profiling data suggested that ~13% of CPU time is spent in building
these maps and performing lookups in them.
Tracking the count is fairly expensive according to profiling data, and
all we need to know is whether labels exist or not.
@brancz brancz requested a review from a team as a code owner August 22, 2023 18:12
@alwaysmeticulous
Copy link

alwaysmeticulous bot commented Aug 22, 2023

✅ Meticulous spotted zero visual differences across 233 screens tested: view results.

Last updated for commit 653ca86. This comment will update as new commits are pushed.

Copy link
Member

@metalmatze metalmatze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super nice on the performance but also some real refactoring goodies in there. Awesome! 🎉 🚀

@brancz brancz merged commit 0cfae40 into main Aug 23, 2023
35 checks passed
@brancz brancz deleted the fg-perf branch August 23, 2023 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants