instanceof vs prop access

Benchmark created on


Setup

class Foo {
	isFoo = true
}

const foo = new Foo()

Test runner

Ready to run.

Testing in
TestOps/sec
instanceof
foo instanceof Foo
ready
prop access
typeof foo === 'object' && foo !== null
 && !!foo.isFoo
ready

Revisions

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