Date.now vs new Date().getTime() vs +new Date (v34)

Revision 34 of this benchmark created on


Preparation HTML

<script>
if (!('now' in Date)) {
 Date.now = function() { return new Date().getTime();}
}
Date.now2 = function() { return +(new Date);}
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Date.now()
Date.now()
ready
+new Date
+new Date
ready
+(new Date) shim
Date.now2();
ready
window.performance.now
window.performance.now();
ready

Revisions

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