Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
tastastasta
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Browser:
Chrome 120
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
number
4769958.5 Ops/sec
lodash
5394613.0 Ops/sec
Script Preparation code:
var intA = 42.034; var strB = "42.034";
Tests:
number
var res = Number(intA) + Number(strB);
lodash
var reTrim = /^\s+|\s+$/g; var reIsBinary = /^0b[01]+$/i; var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; var reIsOctal = /^0o[0-7]+$/i; function isSymbol(value) { return typeof value == 'symbol' || (isObjectLike(value) && baseGetTag(value) == symbolTag); } function isObjectLike(value) { return value != null && typeof value == 'object'; } function isObject(value) { var type = typeof value; return value != null && (type == 'object' || type == 'function'); } function toNumber(value) { if (typeof value == 'number') { return value; } if (isSymbol(value)) { return NAN; } if (isObject(value)) { var other = typeof value.valueOf == 'function' ? value.valueOf() : value; value = isObject(other) ? (other + '') : other; } if (typeof value != 'string') { return value === 0 ? value : +value; } value = value.replace(reTrim, ''); var isBinary = reIsBinary.test(value); return (isBinary || reIsOctal.test(value)) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : (reIsBadHex.test(value) ? NAN : +value); } var res = toNumber(intA) + toNumber(strB);