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 249092 3c5db371a6385189c4d2d7d23d8d3e6113a514d4
parent 249091 f919a460dc30cacdf64465560f7d4f3ed85a3b01
child 249093 5032626927f25877c355a1e8e64f012fcb8e0937
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjsantell
bugs1118295
milestone37.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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 });