Title: [118521] trunk
Revision
118521
Author
[email protected]
Date
2012-05-25 06:42:41 -0700 (Fri, 25 May 2012)

Log Message

Web Inspector: drop obsolete WebInspector.Uint32Array and adjust snapshot chunk size for better transfer-snapshot metric.
https://bugs.webkit.org/show_bug.cgi?id=87490

Originally WebInspector.Uint32Array was used for dynamic array
reallocation because we had no information about expected arrays sizes.
Now we have these sizes and allocates array precisely.

Reviewed by Yury Semikhatsky.

Source/WebCore:

* bindings/v8/ScriptHeapSnapshot.cpp:
(WebCore):
* inspector/front-end/HeapSnapshot.js:
* inspector/front-end/HeapSnapshotLoader.js:
(WebInspector.HeapSnapshotLoader.prototype._parseUintArray):
(WebInspector.HeapSnapshotLoader.prototype.pushJSONChunk):

LayoutTests:

* inspector/profiler/heap-snapshot-test.js:
(initialize_HeapSnapshotTest.):

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (118520 => 118521)


--- trunk/LayoutTests/ChangeLog	2012-05-25 13:10:58 UTC (rev 118520)
+++ trunk/LayoutTests/ChangeLog	2012-05-25 13:42:41 UTC (rev 118521)
@@ -1,3 +1,17 @@
+2012-05-25  Ilya Tikhonovsky  <[email protected]>
+
+        Web Inspector: drop obsolete WebInspector.Uint32Array and adjust snapshot chunk size for better transfer-snapshot metric.
+        https://bugs.webkit.org/show_bug.cgi?id=87490
+
+        Originally WebInspector.Uint32Array was used for dynamic array
+        reallocation because we had no information about expected arrays sizes.
+        Now we have these sizes and allocates array precisely.
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/profiler/heap-snapshot-test.js:
+        (initialize_HeapSnapshotTest.):
+
 2012-05-25  Christophe Dumez  <[email protected]>
 
         [EFL] fast/forms/color/input-value-sanitization-color.html can be unskipped

Modified: trunk/LayoutTests/inspector/profiler/heap-snapshot-test.js (118520 => 118521)


--- trunk/LayoutTests/inspector/profiler/heap-snapshot-test.js	2012-05-25 13:10:58 UTC (rev 118520)
+++ trunk/LayoutTests/inspector/profiler/heap-snapshot-test.js	2012-05-25 13:42:41 UTC (rev 118521)
@@ -536,6 +536,10 @@
 
         rawSnapshot.strings = this._strings.slice();
 
+        var meta = rawSnapshot.snapshot.meta;
+        rawSnapshot.snapshot.edge_count = rawSnapshot.edges.length / meta.edge_fields.length;
+        rawSnapshot.snapshot.node_count = rawSnapshot.nodes.length / meta.node_fields.length;
+
         return rawSnapshot;
     },
 

Modified: trunk/Source/WebCore/ChangeLog (118520 => 118521)


--- trunk/Source/WebCore/ChangeLog	2012-05-25 13:10:58 UTC (rev 118520)
+++ trunk/Source/WebCore/ChangeLog	2012-05-25 13:42:41 UTC (rev 118521)
@@ -1,3 +1,21 @@
+2012-05-25  Ilya Tikhonovsky  <[email protected]>
+
+        Web Inspector: drop obsolete WebInspector.Uint32Array and adjust snapshot chunk size for better transfer-snapshot metric.
+        https://bugs.webkit.org/show_bug.cgi?id=87490
+
+        Originally WebInspector.Uint32Array was used for dynamic array
+        reallocation because we had no information about expected arrays sizes.
+        Now we have these sizes and allocates array precisely.
+
+        Reviewed by Yury Semikhatsky.
+
+        * bindings/v8/ScriptHeapSnapshot.cpp:
+        (WebCore):
+        * inspector/front-end/HeapSnapshot.js:
+        * inspector/front-end/HeapSnapshotLoader.js:
+        (WebInspector.HeapSnapshotLoader.prototype._parseUintArray):
+        (WebInspector.HeapSnapshotLoader.prototype.pushJSONChunk):
+
 2012-05-25  Alexander Pavlov  <[email protected]>
 
         Web Inspector: cmd-[ shortcut navigates page and is fr-keyboard incompatible

Modified: trunk/Source/WebCore/bindings/v8/ScriptHeapSnapshot.cpp (118520 => 118521)


--- trunk/Source/WebCore/bindings/v8/ScriptHeapSnapshot.cpp	2012-05-25 13:10:58 UTC (rev 118520)
+++ trunk/Source/WebCore/bindings/v8/ScriptHeapSnapshot.cpp	2012-05-25 13:42:41 UTC (rev 118521)
@@ -68,7 +68,7 @@
     OutputStreamAdapter(ScriptHeapSnapshot::OutputStream* output)
         : m_output(output) { }
     void EndOfStream() { m_output->Close(); }
-    int GetChunkSize() { return 10240; }
+    int GetChunkSize() { return 102400; }
     WriteResult WriteAsciiChunk(char* data, int size)
     {
         m_output->Write(String(data, size));

Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js (118520 => 118521)


--- trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js	2012-05-25 13:10:58 UTC (rev 118520)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js	2012-05-25 13:42:41 UTC (rev 118521)
@@ -30,36 +30,7 @@
 
 /**
  * @constructor
- * @param {number=} size
  */
-WebInspector.Uint32Array = function(size)
-{
-    const preallocateSize = 1000;
-    size = size || preallocateSize;
-    this._usedSize = 0;
-    this._array = new Uint32Array(preallocateSize);
-}
-
-WebInspector.Uint32Array.prototype = {
-    push: function(value)
-    {
-        if (this._usedSize + 1 > this._array.length) {
-            var tempArray = new Uint32Array(this._array.length * 2);
-            tempArray.set(this._array);
-            this._array = tempArray;
-        }
-        this._array[this._usedSize++] = value;
-    },
-
-    get array()
-    {
-        return this._array.subarray(0, this._usedSize);
-    }
-}
-
-/**
- * @constructor
- */
 WebInspector.HeapSnapshotArraySlice = function(array, start, end)
 {
     this._array = array;

Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshotLoader.js (118520 => 118521)


--- trunk/Source/WebCore/inspector/front-end/HeapSnapshotLoader.js	2012-05-25 13:10:58 UTC (rev 118520)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshotLoader.js	2012-05-25 13:42:41 UTC (rev 118521)
@@ -101,7 +101,7 @@
                 this._json = this._json.slice(startIndex);
                 return true;
             }
-            this._array.push(nextNumber);
+            this._array[this._arrayIndex++] = nextNumber;
         }
     },
 
@@ -149,7 +149,8 @@
             this._json = this._json.slice(bracketIndex + 1);
             var node_fields_count = this._snapshot.snapshot.meta.node_fields.length;
             var nodes_length = this._snapshot.snapshot.node_count * node_fields_count;
-            this._array = new WebInspector.Uint32Array(nodes_length);
+            this._array = new Uint32Array(nodes_length);
+            this._arrayIndex = 0;
             this._state = "parse-nodes";
             this.pushJSONChunk("");
             break;
@@ -157,7 +158,7 @@
         case "parse-nodes": {
             if (this._parseUintArray())
                 return;
-            this._snapshot.nodes = this._array.array;
+            this._snapshot.nodes = this._array;
             this._state = "find-edges";
             this._array = null;
             this.pushJSONChunk("");
@@ -174,7 +175,8 @@
             this._json = this._json.slice(bracketIndex + 1);
             var edge_fields_count = this._snapshot.snapshot.meta.edge_fields.length;
             var edges_length = this._snapshot.snapshot.edge_count * edge_fields_count;
-            this._array = new WebInspector.Uint32Array(edges_length);
+            this._array = new Uint32Array(edges_length);
+            this._arrayIndex = 0;
             this._state = "parse-edges";
             this.pushJSONChunk("");
             break;
@@ -182,7 +184,7 @@
         case "parse-edges": {
             if (this._parseUintArray())
                 return;
-            this._snapshot.edges = this._array.array;
+            this._snapshot.edges = this._array;
             this._array = null;
             this._state = "find-strings";
             this.pushJSONChunk("");
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to