bench.js
function constantCompare(a, b, n) {
	var n2 = n,
		then = Date.now(),
		eq = false,
		len, i
	while (n2--) {
		len = Math.max(a.length, b.length)
		for (i = 0; i < len; i++) {
			if (a.length >= i && b.length >= i && a[i] !== b[i]) {
				eq = false
			}
		}
	}
	return (Date.now() - then) * 1e6 / n
}
function constantCompare(a, b, n) {
	var n2 = n,
		then = Date.now(),
		eq = false,
		len, i
	while (n2--) {
		len = Math.max(a.length, b.length)
		for (i = 0; i < len; i++) {
			if (a.length >= i && b.length >= i && a[i] !== b[i]) {
				eq = false
			}
		}
	}
	return (Date.now() - then) * 1e6 / n
}
function constantCompare ( a , b , n ) { var n2 = n , then = Date . now ( ) , eq = false , len , i while ( n2 -- ) { len = Math . max ( a . length , b . length ) for ( i = 0 ; i < len ; i ++ ) { if ( a . length >= i && b . length >= i && a [ i ] !== b [ i ] ) { eq = false } } } return ( Date . now ( ) - then ) * 1e6 / n }
Compute a==b n times with a constant algorithm
@param {string} a
@param {string} b
@param {number} n
@returns {number} The time per comparison (in ns)
Compute a == b n times with a constant algorithm