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:
one year ago
by:
Guest
Go 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:
one year 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
getRoundedDate
342K/s
ttlSec
330K/s
getTtlFromKey
109K/s
View exact numbers
Test name
Executions per second
✓
getRoundedDate
342,152 Ops/sec
ttlSec
330,440 Ops/sec
getTtlFromKey
108,750 Ops/sec
Related benchmarks
ISO Date vs Epoch
Date vs moment with compare
Moment Unix vs Vanilla Javascript
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?