Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
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/136.0.0.0 Safari/537.36 Edg/136.0.0.0
Browser:
Chrome 136
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Benchmark engine:
Benchmark.js
Short Number
309K/s
Long Number
290K/s
Long String
224K/s
Short String
223K/s
View exact numbers
Test name
Executions per second
✓
Short Number
308,641 Ops/sec
Long Number
289,781 Ops/sec
Long String
224,265 Ops/sec
Short String
223,143 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);