var arr = [];
var y = 0
if (arr.length) {
y = 1
} else {
y = 2
}
if (arr.length > 0) {
y = 1
} else {
y = 2
}
--enable-precise-memory-info
flag.
Test case name | Result |
---|---|
array length | |
array length > 0 |
Test name | Executions per second |
---|---|
array length | 8080099.5 Ops/sec |
array length > 0 | 8385852.0 Ops/sec |