direct comparison vs array lookup

Benchmark created on


Setup

const styleProps = ['class', 'style'];

const propName = 'another';

Test runner

Ready to run.

Testing in
TestOps/sec
direct comparison
propName === 'class' || propName === 'style'
ready
array lookup
['class', 'style'].includes(propName)
ready
top array lookup
styleProps.includes(propName)
ready

Revisions

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