Date.now vs Date.getTime (v3)

Revision 3 of this benchmark created by Tarun on


Setup

var dateNowOrGetTime = function() {
            if (Date.now) {
              return Date.now();
            } else {
              return new Date().getTime();
            }
        };

Test runner

Ready to run.

Testing in
TestOps/sec
Date.now();
var foo = Date.now();
ready
Date.getTime()
var foo = new Date().getTime();
ready
Date.now() or Date.getTime()
var foo = dateNowOrGetTime();
ready

Revisions

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