Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Compare number vs compare string
Test the speed of comparing number vs comparing strings in js
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Browser:
Chrome 131
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Short Number
236096.4 Ops/sec
Long Number
187965.0 Ops/sec
Short String
217426.7 Ops/sec
Long String
199062.3 Ops/sec
Script Preparation code:
var numShort1 = 2**32; var numShort2 = 2**32; var numShort3 = 2**31; var numLong1 = 2**256; var numLong2 = 2**256; var numLong3 = 2**255; var stringShort1 = "test"; var stringShort2 = "test"; var stringShort3 = "t35t"; var stringLong1 = "cyclonicBarrierTechnology"; var stringLong2 = "cyclonicBarrierTechnology"; var stringLong3 = "cockAndBallTorture";
Tests:
Short Number
console.log(numShort1 == numShort3 || numShort1 == numShort2);
Long Number
console.log(numLong1 == numLong3 || numLong1 == numLong2);
Short String
console.log(stringShort1 == stringShort3 || stringShort1 == stringShort2);
Long String
console.log(stringLong1 == stringLong3 || stringLong1 == stringLong2);