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

Revision 22 of this benchmark created on


Description

Some legacy if performance is lost

Setup

var now = Date.now || function() {
        return new Date().getTime();
      }
    var legacy = function() {
      return new Date().getTime();
    }

Test runner

Ready to run.

Testing in
TestOps/sec
Date.now
Date.now();
ready
+new Date()
+new Date();
ready
legacy now()
legacy();
ready
cached now
now();
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.