Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
parseInt vs Math.trunc
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0
Browser:
Firefox 129
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Trunc
2258.0M/s
parseInt
2154.3M/s
View exact numbers
Test name
Executions per second
✓
Trunc
2,258,044,416 Ops/sec
parseInt
2,154,347,008 Ops/sec
Script Preparation code:
var num = Math.random() * 100;
Tests:
Trunc
Math.trunc(num);
parseInt
parseInt(num);