Improve flame graph rendering performance#4455
Conversation
Codecov ReportBase: 88.59% // Head: 88.64% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #4455 +/- ##
==========================================
+ Coverage 88.59% 88.64% +0.04%
==========================================
Files 284 284
Lines 25559 25528 -31
Branches 6877 6860 -17
==========================================
- Hits 22644 22629 -15
+ Misses 2708 2692 -16
Partials 207 207
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
cd5fc51 to
eb78e56
Compare
julienw
left a comment
There was a problem hiding this comment.
This looks pretty good to me, thanks a ton!
I only have a small comment about the result of the fitted text algorithm, tell me what you think.
In the future I'd like to use the real measureText, but with bisecting instead of iterating, which hopefully should be faster... but we'll have to profile to be sure :).
1. Use `FastFillStyle` to reduce style switching. 2. Save `fillRect`s for white border by drawing rectangle at an offset instead.
eb78e56 to
e558603
Compare
I was actually looking into improving this further locally. I tried bisection using |
Thanks for looking at it at least, we can discuss other solutions later. Maybe we can still find approximations that would work with the current not-very-good cases. |
I'm not sure if I'm missing something more obvious, but these are the things being done in this PR:
fillStyleandfillRectcalls:FastFillStyle.dragX/dragYout of chart viewport state.getFittedTextwith an equivalent implementation that does less work.Fixes #4451
Production | Profile of panning the flame graph in production
Deploy preview | Profile of panning the flame graph with PR changes
Some other things I tried:
_drawCanvastime reducing from 4 ms to 3.8 ms.requestAnimationFramefor FlameGraph canvas. This seems to make it slightly smoother, but not sure how to confirm. Profile