Quickest way to a UNIX Date

JavaScript performance comparison

Revision 21 of this test case created

Info

Pits ES5.1 Date.now() against backwards-compatible alternatives.

Preparation code

<script src="http://momentjs.com/downloads/moment.min.js"></script>

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() (ES5.1, IE9+)
Date.now()
pending…
new Date().getTime() (All Browsers)
new Date().getTime()
pending…
+new Date() (All Browsers)
+new Date()
pending…
+new Date (All Browsers)
+new Date
pending…
moment().valueOf()
moment().valueOf()
pending…
+moment()
+moment()
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