var object = {};
object["p1"] = 1;
object["p2"] = 2;
object["p3"] = 3;
object["p4"] = 4;
object["p5"] = 5;
object["p6"] = 6;
object["p7"] = 7;
object["p8"] = 8;
object["p9"] = 9;
var array = [];
array.push("p1",1);
array.push("p2",2);
array.push("p3",3);
array.push("p4",4);
array.push("p5",5);
array.push("p6",6);
array.push("p7",7);
array.push("p8",8);
array.push("p9",9);
var object = {};
object["p1"] = "1";
object["p2"] = "2";
object["p3"] = "3";
object["p4"] = "4";
object["p5"] = "5";
object["p6"] = "6";
object["p7"] = "7";
object["p8"] = "8";
object["p9"] = "9";
var array = [];
array.push("p1",1);
array.push("p2",2);
array.push("p3",3);
array.push("p4",4);
array.push("p5",5);
array.push("p6",6);
array.push("p7",7);
array.push("p8",8);
array.push("p9",9);
var array = [];
array.length = 18
var index = 0;
array[i++] = "p1";
array[i++] = 1;
array[i++] = "p2";
array[i++] = 2;
array[i++] = "p3";
array[i++] = 3;
array[i++] = "p4";
array[i++] = 4;
array[i++] = "p5";
array[i++] = 5;
array[i++] = "p6";
araay[i++] = 6;
array[i++] = "p7";
araay[i++] = 7;
array[i++] = "p8";
array[i++] = 8;
array[i++] = "p9";
array[i++] = 9;
var array = [];
array.length = 18
var index = 0;
array[i++] = "p1";
array[i++] = "1";
array[i++] = "p2";
array[i++] = "2";
array[i++] = "p3";
array[i++] = "3";
array[i++] = "p4";
array[i++] = "4";
array[i++] = "p5";
array[i++] = "5";
array[i++] = "p6";
array[i++] = "6";
array[i++] = "p7";
array[i++] = "7";
array[i++] = "p8";
array[i++] = "8";
array[i++] = "p9";
array[i++] = "9";
--enable-precise-memory-info
flag.
Test case name | Result |
---|---|
dynamic create object integer value | |
dynamic create array integer value | |
dynamic create object string value | |
dynamic create array string value | |
buffered array integer values | |
buffered array string value |
Test name | Executions per second |
---|---|
dynamic create object integer value | 727867584.0 Ops/sec |
dynamic create array integer value | 16134010.0 Ops/sec |
dynamic create object string value | 147705328.0 Ops/sec |
dynamic create array string value | 17575068.0 Ops/sec |
buffered array integer values | 0.0 Ops/sec |
buffered array string value | 243943.7 Ops/sec |
Overview
MeasureThat.net is a website that allows users to create and run JavaScript microbenchmarks. The provided JSON data represents a benchmark with five test cases, each testing different ways of creating an object or array in JavaScript.
Test Cases
The test cases are:
object["p1"] = 1;
) and assigning integer values.push()
method and assigning integer values.object["p1"] = "string";
) and assigning string values.push()
method and assigning string values.Performance Comparison
The latest benchmark results show the performance of each test case across different browsers and devices. The results indicate that:
Conclusion
The test cases provide insight into the performance of different JavaScript creation methods. The results suggest that creating objects using bracket notation and assigning string values can be faster than other methods. It's essential to consider these performance implications when optimizing code for efficiency and scalability.