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; rv:135.0) Gecko/20100101 Firefox/135.0
Browser:
Firefox 135
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Short Number
199266.6 Ops/sec
Long Number
198856.8 Ops/sec
Short String
197431.7 Ops/sec
Long String
195987.7 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);