Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
init on demand vs at the beginning
(version: 1)
Comparing performance of:
includes vs lookup
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
function a(arr) { let kinds; return (node) => { kinds ??= new Set(arr); return kinds.has(node.kind); }; } function b(arr) { const kinds = new Set(arr); return (node) => kinds.has(node.kind); } const c = a([1, 2, 3]); const d = b([1, 2, 3]);
Tests:
includes
return c({kind: 1});
lookup
return d({kind: 1});
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
includes
lookup
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.4 Safari/605.1.15
Browser/OS:
Safari 18 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
includes
188384832.0 Ops/sec
lookup
649772160.0 Ops/sec
Related benchmarks:
inner-vs-outer-fn-declaration-2
Constructor vs object literal 2
function vs const
Short undef check
func vs object vs symbol
Unique values with Lodash
Function vs () =>
const vs let vs var (fixed) 2
setprototype
Comments
Confirm delete:
Do you really want to delete benchmark?