Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Math.log10() vs .toString().length
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Mobile/15E148 Safari/604.1
Browser:
Mobile Safari 18
Operating system:
iOS 18.5
Device Platform:
Mobile
Date tested:
10 months ago
Test name
Executions per second
Math.log10(), .floor()
14787.9 Ops/sec
Math.log10(), OR
18148.8 Ops/sec
.toString().length
4394.2 Ops/sec
Tests:
Math.log10(), .floor()
let num = 5000; let nums = []; for(let i = 1; i <= num; ++i) { nums.push(Math.floor(Math.log10(i))); }
Math.log10(), OR
let num = 5000; let nums = []; for(let i = 1; i <= num; ++i) { nums.push(Math.log10(i) | 0); }
.toString().length
let num = 5000; let nums = []; for(let i = 1; i <= num; ++i) { nums.push(i.toString().length - 1); }