Date.now() vs (new Date).getTime()

Edit on GitHub

Measure the difference between creating a new Date instance and calling getTime() and Date.now().

Setup

var optimizerPls = null;

Tests

  • Date.now()

    optimizerPls = Date.now();
  • (new Date).getTime()

    optimizerPls = (new Date).getTime();