Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Moment@2.30
(version: 1)
Comparing performance of:
getRoundedDate vs ttlSec vs getTtlFromKey
Created:
9 months ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/npm/moment@2.30.1/moment.min.js"></script>
Script Preparation code:
var unix = 1724409214;
Tests:
getRoundedDate
moment(new Date()).add(5, 'minutes').toISOString().slice(0, -11)
ttlSec
moment().add(3600, 's').utc().toISOString()
getTtlFromKey
const cacheDurationMinutes = 60; const defaultTtl = cacheDurationMinutes * 60; const effectiveDate = '2025-07-18T18'; const now = moment.utc(); const keyEffectiveDateStart = moment.utc(effectiveDate); const keyEffectiveDateEnd = keyEffectiveDateStart.clone() .add(cacheDurationMinutes, 'minutes'); const secondsTillKeyEnd = keyEffectiveDateEnd.diff(now, 'seconds'); return Math.min(defaultTtl, Math.max(0, secondsTillKeyEnd)) || defaultTtl;
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
getRoundedDate
ttlSec
getTtlFromKey
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
9 months ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36
Browser/OS:
Chrome 138 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
getRoundedDate
342151.5 Ops/sec
ttlSec
330440.1 Ops/sec
getTtlFromKey
108750.3 Ops/sec
Related benchmarks:
ISO Date vs Epoch
Date vs moment with compare
Moment time plus vs ad
Moment Unix vs Vanilla Javascript
Offset Delta
Current Year First Date
MomentJS vs Vanilla JS Time incrementing and using as dictionary key
Moment@2.29
MomentJS VS Date
Comments
Confirm delete:
Do you really want to delete benchmark?