Test name | Executions per second |
---|---|
test1 | 583.8 Ops/sec |
test2 | 577.8 Ops/sec |
var if1 = true;
var if2 = true;
var if3 = false;
function a() {
var b = {};
if (if1) {
b.a = document.createElement("a");
}
if (if2) {
b.b = document.createElement("a");
}
if (if3) {
b.c = document.createElement("a");
}
return b;
}
function c() {
var d = [];
if (if1) {
d.push(document.createElement("a"));
}
if (if2) {
d.push(document.createElement("a"));
}
if (if3) {
d.push(document.createElement("a"));
}
return d;
}
for (let i = 0; i < 1000; ++i) {
a();
}
for (let i = 0; i < 1000; ++i) {
c();
}