Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
Chrome 68
Windows
Desktop
6 years ago
Test name Executions per second
Moment diff to moment d 260058.6 Ops/sec
Moment new Date diff to moment d 238544.6 Ops/sec
Moment Date.now diff to moment d 258331.4 Ops/sec
Moment diff to precreated moment 350440.4 Ops/sec
e 310182.2 Ops/sec
Date.now minus date, division 1258355.9 Ops/sec
moment Date.now diff to existing m 292023.6 Ops/sec
New Date() minus date, division 974202.2 Ops/sec
Moment diff to moment d, divide time 360343.5 Ops/sec
Math with moment and existing moment 589945.8 Ops/sec
Math with Date.now and moment 1108541.2 Ops/sec
Math with new Date and m.toDate 976483.2 Ops/sec
Math with new Date and m 818889.4 Ops/sec
Math with Date.now and existing moment toDate 1217869.4 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • Moment diff to moment d

  • Moment new Date diff to moment d

  • Moment Date.now diff to moment d

  • Moment diff to precreated moment

  • e

  • Date.now minus date, division

  • moment Date.now diff to existing m

  • New Date() minus date, division

  • Moment diff to moment d, divide time

  • Math with moment and existing moment

  • Math with Date.now and moment

  • Math with new Date and m.toDate

  • Math with new Date and m

  • Math with Date.now and existing moment toDate


;