Bug 1118295 - Optimize emptying the `prevFrames` array in FlameGraphUtils.createFlameGraphDataFromSamples, r=jsantell
authorVictor Porof <vporof@mozilla.com>
Sun, 11 Jan 2015 09:54:26 -0500
changeset 223091 3c5db371a6385189c4d2d7d23d8d3e6113a514d4
parent 223090 f919a460dc30cacdf64465560f7d4f3ed85a3b01
child 223092 5032626927f25877c355a1e8e64f012fcb8e0937
push id10758
push uservporof@mozilla.com
push dateSun, 11 Jan 2015 14:54:38 +0000
treeherderfx-team@3c5db371a638 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjsantell
bugs1118295
milestone37.0a1
Bug 1118295 - Optimize emptying the `prevFrames` array in FlameGraphUtils.createFlameGraphDataFromSamples, r=jsantell
browser/devtools/shared/widgets/FlameGraph.jsm
--- a/browser/devtools/shared/widgets/FlameGraph.jsm
+++ b/browser/devtools/shared/widgets/FlameGraph.jsm
@@ -822,20 +822,17 @@ let FlameGraphUtils = {
           });
         }
 
         frameIndex++;
       }
 
       // Previous frames at stack depths greater than the current sample's
       // maximum need to be nullified. It's nonsensical to reuse them.
-      for (let i = frameIndex; i < prevFrames.length; i++) {
-        prevFrames[i] = null;
-      }
-
+      prevFrames.length = frameIndex;
       prevTime = time;
     }
 
     // 3. Convert the buckets into a data source usable by the FlameGraph.
     // This is a simple conversion from a Map to an Array.
 
     for (let [color, blocks] of buckets) {
       out.push({ color, blocks });