Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Lodash vs Native Date string comparison
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36
Browser:
Chrome 122
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
Date Object without lodash
1082330.0 Ops/sec
String Parse with lodash
3044935.5 Ops/sec
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.4/lodash.min.js"></script>
Tests:
Date Object without lodash
const articles = ["10-2-2021", "9-3-2022", "2-4-2021"]; const byYear = {}; articles.forEach(el => { const year = new Date(el).getFullYear(); const objYear = byYear[year]; byYear[year] = Array.isArray(objYear) ? [...objYear, el] : [el]; });
String Parse with lodash
const articles = ["10-2-2021", "9-3-2022", "2-4-2021"]; const articleYear = (posted_date) => posted_date.split("-").pop(); const articlesByYear = _.groupBy(articles, articleYear);