Closed Bug 1201542 Opened 9 years ago Closed 9 years ago

Implement `allocationSite` breakdown for CensusTreeNode

Categories

(DevTools :: Memory, defect)

41 Branch
defect
Not set
normal

Tracking

(firefox44 fixed)

RESOLVED FIXED
Firefox 44
Tracking Status
firefox44 --- fixed

People

(Reporter: jsantell, Assigned: fitzgen)

References

Details

Attachments

(1 file, 1 obsolete file)

      No description provided.
Assignee: nobody → jsantell
Status: NEW → ASSIGNED
Depends on: 1201621
Sending your way
Assignee: jsantell → nfitzgerald
Comment on attachment 8675976 [details] [diff] [review]
Implement `allocationSite` breakdown for CensusTreeNode

Review of attachment 8675976 [details] [diff] [review]:
-----------------------------------------------------------------

some comments but lgtm!

::: devtools/shared/heapsnapshot/census-tree-node.js
@@ +61,5 @@
> + * @returns {String}
> + *          The unique string that can be used as a key in a FrameCache.
> + */
> +FrameCache.hash = function (frame) {
> +  return `${frame.functionDisplayName},${frame.source},${frame.line},${frame.column},${frame.asyncCause}`;

Do we always have a column? What about when functions don't have names? Not sure if SavedFrames handles this better than the profiler (I think it does, and tbf it's not hard to handle this better than profiler);

A line like: `p.then(function(){},function(){})` where two anon functions are used

::: devtools/shared/heapsnapshot/tests/unit/head_heapsnapshot.js
@@ +155,5 @@
> +}
> +
> +function savedFrameReplacer(key, val) {
> +  if (isSavedFrame(val)) {
> +    return "<SavedFrame '" + val.toString().split(/\n/g).shift() + "'>";

template strings might be nicer

@@ +188,5 @@
>  }
>  
>  // Deep structural equivalence that can handle Map objects in addition to plain
>  // objects.
>  function assertStructurallyEquivalent(actual, expected, path="root") {

Wonder if we should roll this into the `breakdownEquals` function I made for breakdowns, if we add map support, and just have it a general structural equiv function?
Attachment #8675976 - Flags: review?(jsantell) → review+
(In reply to Jordan Santell [:jsantell] [@jsantell] from comment #4)
> Comment on attachment 8675976 [details] [diff] [review]
> Implement `allocationSite` breakdown for CensusTreeNode
> 
> Review of attachment 8675976 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> some comments but lgtm!
> 
> ::: devtools/shared/heapsnapshot/census-tree-node.js
> @@ +61,5 @@
> > + * @returns {String}
> > + *          The unique string that can be used as a key in a FrameCache.
> > + */
> > +FrameCache.hash = function (frame) {
> > +  return `${frame.functionDisplayName},${frame.source},${frame.line},${frame.column},${frame.asyncCause}`;
> 
> Do we always have a column? What about when functions don't have names? Not
> sure if SavedFrames handles this better than the profiler (I think it does,
> and tbf it's not hard to handle this better than profiler);
> 
> A line like: `p.then(function(){},function(){})` where two anon functions
> are used

Yes, we always have a column. SpiderMonkey will infer display names in most cases, and worst case scenario it will be undefined, but that's ok we still want that to contribute to the hash as it is part of each frame's identity.

> @@ +188,5 @@
> >  }
> >  
> >  // Deep structural equivalence that can handle Map objects in addition to plain
> >  // objects.
> >  function assertStructurallyEquivalent(actual, expected, path="root") {
> 
> Wonder if we should roll this into the `breakdownEquals` function I made for
> breakdowns, if we add map support, and just have it a general structural
> equiv function?

What's nice about this function now is that it keeps track of where you are in the structure via the path parameter and asserts along the way rather than returning true/false which gives better failure messages. Both of these things you would not want in an equality checker because (a) you want to be fast and not carry around long strings, and (b) you don't want to assert but return true or false. Additionally, it does not attempt to handle cyclic values at all, which a robust equality checker handling untrusted data should. I think we should keep this as a test utility.
I think this was a bad rebase.
Flags: needinfo?(nfitzgerald)
Attachment #8675976 - Attachment is obsolete: true
New try push, apparently that last one was affected by the S3 migration.

https://treeherder.mozilla.org/#/jobs?repo=try&revision=7ae2f6266fdf
Busted XPCSHell tests like this -> https://treeherder.mozilla.org/logviewer.html#?job_id=5260235&repo=fx-team I had to back out bug 1217239 as it's dependent on this one.
Flags: needinfo?(nfitzgerald)
https://hg.mozilla.org/mozilla-central/rev/e5d4bd62d234
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 44
Flags: needinfo?(nfitzgerald)
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: