set if vs ternary

Benchmark created on


Setup

 const attributeHandler = {}
 const initialValue = 123

Test runner

Ready to run.

Testing in
TestOps/sec
ternary
attributeHandler.default = 'default' in attributeHandler ? attributeHandler.default : initialValue
ready
if
if (!('default' in attributeHandler)) attributeHandler.default = initialValue
ready

Revisions

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