Skip to content

Implement the "collapse resource" transform with the help of the "collapse direct recursion" transform.#5824

Merged
mstange merged 2 commits intofirefox-devtools:mainfrom
mstange:simplify-collapse-resource
Feb 27, 2026
Merged

Implement the "collapse resource" transform with the help of the "collapse direct recursion" transform.#5824
mstange merged 2 commits intofirefox-devtools:mainfrom
mstange:simplify-collapse-resource

Conversation

@mstange
Copy link
Contributor

@mstange mstange commented Feb 9, 2026

This simplifies the code considerably.

There is a slight behavior change in the case where there's an implementation filter, see the change to the test. I think the new behavior makes more sense, and it is consistent with the existing behavior of the collapse-direct-resource transform.

I'm not worried about breaking URLs because the collapse resource transform is only very rarely used, and the combination with an implementation filter is probably even rarer.

This change also simplifies the creation of the new frame table: We don't need to add any new frames, we can just swap out the func on all existing frames whose original func is from the collapsed resource.

@mstange mstange requested a review from canova February 9, 2026 16:27
@mstange mstange self-assigned this Feb 9, 2026
@codecov
Copy link

codecov bot commented Feb 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.56%. Comparing base (37b31b0) to head (806adbc).
⚠️ Report is 35 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5824   +/-   ##
=======================================
  Coverage   85.56%   85.56%           
=======================================
  Files         319      319           
  Lines       31420    31499   +79     
  Branches     8661     8705   +44     
=======================================
+ Hits        26885    26953   +68     
- Misses       4104     4115   +11     
  Partials      431      431           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@canova canova left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks!

The new behavior does indeed look better to me.
It's a bit unfortunate that we might break the old urls, but like you said, it's pretty rare.

Comment on lines +1133 to +1140
* | | / \
* v v v v
* C.js I.js E.js I.js
* | |
* v v
* D.cpp:firefox F.cpp
* | |
* v v
Copy link
Member

Choose a reason for hiding this comment

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

Oh, yeah the new behavior looks more like what I would expect too.

newStackTable,
getMapStackUpdater(oldStackToNewStack)
);
return collapseDirectRecursion(newThread, collapsedFuncIndex, implementation);
Copy link
Member

Choose a reason for hiding this comment

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

Ni: It would be nice to explain the new approach in a function comment of collapseResource. It might be a bit surprising to read that it uses the collapse recursion now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

…lapse direct recursion" transform.

This simplifies the code considerably.

There is a slight behavior change in the case where there's an implementation
filter, see the change to the test. I think the new behavior makes more sense,
and it is consistent with the existing behavior of the collapse-direct-resource
transform.

I'm not worried about breaking URLs because the collapse resource transform
is only very rarely used, and the combination with an implementation filter
is probably even rarer.

This change also simplifies the creation of the new frame table: We don't
need to add any new frames, we can just swap out the func on all existing
frames whose original func is from the collapsed resource.
@mstange mstange force-pushed the simplify-collapse-resource branch from bcbdda9 to 806adbc Compare February 27, 2026 22:41
@mstange mstange enabled auto-merge February 27, 2026 22:43
@mstange mstange merged commit 971dd23 into firefox-devtools:main Feb 27, 2026
19 checks passed
@canova canova mentioned this pull request Mar 3, 2026
canova added a commit that referenced this pull request Mar 3, 2026
Changes:

[fatadel] Fix crash when nativeSymbol index is out of bounds in assembly
view (#5850)
[depfu[bot]] Update all Yarn dependencies (2026-02-25) (#5859)
[Nazım Can Altınova] Fix the color of dark mode back arrow svg (#5863)
[fatadel] Force canvas redraw when system theme changes (#5861)
[Nazım Can Altınova] Fix unhandled promise rejection in
setupInitialUrlState (#5864)
[fatadel] Persist selected marker in URL and show sticky tooltip on load
(#5847)
[Markus Stange] Implement the "collapse resource" transform with the
help of the "collapse direct recursion" transform. (#5824)
[Markus Stange] Bump rollup from 2.79.2 to 2.80.0 (#5868)
[Markus Stange] Remove async attribute from module script tag. (#5870)
[Nazım Can Altınova] Update the docsify package that's used in the user
documentation (#5872)
[Markus Stange] Share stackTable, frameTable, funcTable, resourceTable
and nativeSymbols between threads (#5482)
[Nazım Can Altınova] Escape CSS URLs that are coming from profiles
(#5874)
[fatadel] Update home page message for the other browser case (#5866)
[fatadel] Add support for ternaries in marker labels (#5857)
[Markus Stange] Reduce allocations for getStackLineInfo +
getStackAddressInfo (#5761)

And special thanks to our localizers:

de: Ger
fy-NL: Fjoerfoks
it: Francesco Lodolo [:flod]
nl: Fjoerfoks
ru: berry
ru: Valery Ledovskoy
zh-TW: Pin-guang Chen
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