Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36
Chrome 91
Linux
Desktop
3 years ago
Test name Executions per second
Moment diff to moment d 389256.9 Ops/sec
Moment new Date diff to moment d 373106.4 Ops/sec
Moment Date.now diff to moment d 341431.5 Ops/sec
Moment diff to precreated moment 496876.1 Ops/sec
e 432475.7 Ops/sec
Date.now minus date, division 1773400.6 Ops/sec
moment Date.now diff to existing m 417252.5 Ops/sec
New Date() minus date, division 1263623.9 Ops/sec
Moment diff to moment d, divide time 465468.8 Ops/sec
Math with moment and existing moment 686418.8 Ops/sec
Math with Date.now and moment 1395036.8 Ops/sec
Math with new Date and m.toDate 1253362.5 Ops/sec
Math with new Date and m 1049461.5 Ops/sec
Math with Date.now and existing moment toDate 1771037.6 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