var object_n = {};
object_n["p1"] = 1;
object_n["p2"] = 2;
object_n["p3"] = 3;
object_n["p4"] = 4;
object_n["p5"] = 5;
object_n["p6"] = 6;
object_n["p7"] = 7;
object_n["p8"] = 8;
object_n["p9"] = 9;
var array_n = [];
array_n.push("p1",1);
array_n.push("p2",2);
array_n.push("p3",3);
array_n.push("p4",4);
array_n.push("p5",5);
array_n.push("p6",6);
array_n.push("p7",7);
array_n.push("p8",8);
array_n.push("p9",9);
var object_s = {};
object_s["p1"] = "1";
object_s["p2"] = "2";
object_s["p3"] = "3";
object_s["p4"] = "4";
object_s["p5"] = "5";
object_s["p6"] = "6";
object_s["p7"] = "7";
object_s["p8"] = "8";
object_s["p9"] = "9";
var array_s = [];
array_s.push("p1","1");
array_s.push("p2","2");
array_s.push("p3","3");
array_s.push("p4","4");
array_s.push("p5","5");
array_s.push("p6","6");
array_s.push("p7","7");
array_s.push("p8","8");
array_s.push("p9","9");
var array_bn = new Array(20);
var i = 0;
array_bn[i++] = "p1";
array_bn[i++] = 1;
array_bn[i++] = "p2";
array_bn[i++] = 2;
array_bn[i++] = "p3";
array_bn[i++] = 3;
array_bn[i++] = "p4";
array_bn[i++] = 4;
array_bn[i++] = "p5";
array_bn[i++] = 5;
array_bn[i++] = "p6";
array_bn[i++] = 6;
array_bn[i++] = "p7";
array_bn[i++] = 7;
array_bn[i++] = "p8";
array_bn[i++] = 8;
array_bn[i++] = "p9";
array_bn[i++] = 9;
var array_bs = new Array(20);
var j = 0;
array_bs[j++] = "p1";
array_bs[j++] = "1";
array_bs[j++] = "p2";
array_bs[j++] = "2";
array_bs[j++] = "p3";
array_bs[j++] = "3";
array_bs[j++] = "p4";
array_bs[j++] = "4";
array_bs[j++] = "p5";
array_bs[j++] = "5";
array_bs[j++] = "p6";
array_bs[j++] = "6";
array_bs[j++] = "p7";
array_bs[j++] = "7";
array_bs[j++] = "p8";
array_bs[j++] = "8";
array_bs[j++] = "p9";
array_bs[j++] = "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 | 23406360.0 Ops/sec |
dynamic create array integer value | 2283800.5 Ops/sec |
dynamic create object string value | 22074230.0 Ops/sec |
dynamic create array string value | 2300722.5 Ops/sec |
buffered array integer values | 4265100.5 Ops/sec |
buffered array string value | 4284390.5 Ops/sec |
Let's break down what's being tested in this benchmark.
What is being tested?
The benchmark is testing the performance of different ways to dynamically create objects or arrays with string values.
Options compared:
{}
syntax, where each property-value pair is assigned individually.[]
syntax, where elements are added using the =
operator.j++
increment.j++
increment.Why these options?
It's likely that the benchmark wants to test the performance of different approaches in various scenarios:
Latest benchmark results:
The latest results show that:
Keep in mind that these results might vary depending on the specific use case, hardware, and software configurations.