New Date value (v2)

Revision 2 of this benchmark created by Kevin Decker on


Description

Different ways of creating a valueOf() of a Date object.

Findings: in Opera 10.60, Chrome 5.0.375.125, Safari 5.0.1 (6533.17.8) and Firefox 3.6.8, Date.now() is the fastest. It’s more than 50% faster than +new Date. Too bad IE8 and below don’t support it.

Test runner

Ready to run.

Testing in
TestOps/sec
Using .valueOf()
new Date().valueOf();
ready
Using .getTime()
new Date().getTime();
ready
+new Date()
+new Date();
ready
+new Date
+new Date;
ready
Date.now()
Date.now();
ready

Revisions

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