Date.now() VS (new Date()).getTime()

JavaScript performance comparison

Revision 2 of this test case created

Info

Date.now is a method that returns the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC, a Mozilla-specific method. sounds like (new Date()).getTime(). in this testcase, i want to know which is faster, Date.now? or (new Date()).getTime()?

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Date.now
Date.now();
pending…
getTime
(function(){ (new Date()).getTime(); })()
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment