Checking types

Benchmark created on


Description

How fast do checking types work?...

Setup

var str = "hello, world!"

function isStrT(str){
	return typeof str === 'string';
}
function isStrC(str){
	return str.constructor === String;
}

Test runner

Ready to run.

Testing in
TestOps/sec
typeof
var result = typeof str === 'string';
ready
constructor
var result = str.constructor === String;
ready
typeof FN
var result = isStrT(str);
ready
constructor FN
var result = isStrC(str);
ready

Revisions

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