Skip to content

Speed up createCallNodeTable by 2.3x #5248

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

Merged
merged 4 commits into from
Feb 23, 2025

Conversation

mstange
Copy link
Contributor

@mstange mstange commented Dec 5, 2024

Production | Deploy preview

Built on top of #4900, but the only real dependency is on the changeset that makes the inlinedInto column a typed array.

Before: https://share.firefox.dev/4fX1MwP (1884 samples in C aka computeCallNodeTable)
After: https://share.firefox.dev/4gjkTAT (804 samples in C aka computeCallNodeTable, 2.3x faster)

Main unminified: https://share.firefox.dev/4fkDOdP
After #4900 unminified: https://share.firefox.dev/4g0ujS7
After #5248 unminified: https://share.firefox.dev/41kpGhe

@mstange mstange self-assigned this Dec 5, 2024
Copy link

codecov bot commented Dec 5, 2024

Codecov Report

Attention: Patch coverage is 98.65772% with 2 lines in your changes missing coverage. Please review.

Project coverage is 85.97%. Comparing base (d8bba23) to head (05d9963).

Files with missing lines Patch % Lines
src/profile-logic/profile-data.js 98.65% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5248   +/-   ##
=======================================
  Coverage   85.96%   85.97%           
=======================================
  Files         312      312           
  Lines       30331    30357   +26     
  Branches     8295     8296    +1     
=======================================
+ Hits        26073    26098   +25     
- Misses       3661     3662    +1     
  Partials      597      597           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mstange mstange changed the title Speed up createCallNodeTable some more Speed up createCallNodeTable by 2.3x Dec 5, 2024
@mstange mstange marked this pull request as ready for review February 14, 2025 03:36
@mstange mstange requested a review from julienw February 14, 2025 03:36
@julienw julienw requested a review from canova February 14, 2025 17:28
@julienw
Copy link
Contributor

julienw commented Feb 14, 2025

Flagging nazim because I'll be PTO the next few days. But I can look at it when I come back.

@julienw julienw removed the request for review from canova February 21, 2025 14:29
Copy link
Contributor

@julienw julienw left a comment

Choose a reason for hiding this comment

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

Thanks, this looks good to me!

Comment on lines 525 to 526
const funcIndex = frameTableFuncCol[frameIndex];
funcCol[callNodeIndex] = funcIndex;
Copy link
Contributor

Choose a reason for hiding this comment

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

super nit: I'd group these into just one line and remove the funcIndex constant. As it is written now, it looks like we'll reuse funcIndex later (but we don't).


const innerWindowID = frameTableInnerWindowIDCol[frameIndex];
if (innerWindowID !== null) {
innerWindowIDCol[callNodeIndex] = innerWindowID;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: what do you think about adding a comment reminding that the TypedArray is initialized with "0"?

hierarchy;

if (length === 0) {
throw new Error('Empty call node table hierarchy');
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a bit worried by this throw. Would it be possible to return something sensible instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, replaced this with a return.

@mstange mstange enabled auto-merge February 23, 2025 01:31
@mstange mstange merged commit e5d011b into firefox-devtools:main Feb 23, 2025
15 of 16 checks passed
@mstange mstange deleted the push-zxksrqmzrrvw branch February 24, 2025 00:21
@julienw julienw mentioned this pull request Mar 3, 2025
julienw added a commit that referenced this pull request Mar 3, 2025
[Julien Wajsberg] Update node to v22 (#5378)
[Markus Stange] Speed up createCallNodeTable by 2.3x (#5248)
[Markus Stange] Remove frameTable.implementation from the processed format. (#5370)
[Florian Quèze] Show size units in the timeline for profiles where profile.meta.sampleUnits.time is "bytes". (#5364)
[Sean Kim] Report nsIRequest::status (nsresult) in the marker (#5375)
[Markus Stange] Change the marker schema to accept a description and get rid of the notion of static fields (#5385)

Also thanks to our localizers:
en-CA: Paul
tr: Grk
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.

2 participants