in-operator vs key access in objects

Benchmark created on


Setup

let obj = {foo: true};
let hit = 'foo';
let miss = 'bar';

Test runner

Ready to run.

Testing in
TestOps/sec
key in object: hit
hit in obj
ready
key in object: miss
miss in obj
ready
obj[key]: hit
obj[hit]
ready
ob[key]: miss
obj[miss]
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.