Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
Negative precision floor: Lodash vs Math.floor
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36
Browser:
Chrome 122
Operating system:
Linux
Device Platform:
Desktop
Date tested:
2 years ago
Benchmark engine:
Benchmark.js
Math.max
6K/s
_.max
2K/s
View exact numbers
Test name
Executions per second
✓
Math.max
5,544 Ops/sec
_.max
1,680 Ops/sec
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.7.11/lodash.min.js'></script>
Script Preparation code:
function getRandomInt(max) { return Math.floor(Math.random() * Math.floor(max)); } var arr = []; for(var i = 0; i < 1000; i++){ arr.push({value:getRandomInt(100)}); }
Tests:
_.max
for (let i = 0; i < arr.length; i++) _.floor(arr[i], -2);
Math.max
for (let i = 0; i < arr.length; i++) Math.floor(arr[i] * 100) / 100;