+new Date vs Date.now() vs performance.now() (v20)

Revision 20 of this benchmark created by Igor Minar on


Description

https://twitter.com/jaffathecake/status/306706682552143872

jaffathecake: Avoid "+new Date" to generate timestamps during animation. Use "Date.now()" or "performance.now()" instead http://t.co/Hle0qzxWeZ

Setup

var perf = performance;
    var i;
    var pNow = performance.now;
    var dNow = Date.now;

Test runner

Ready to run.

Testing in
TestOps/sec
Date.now
Date.now();
ready
+new Date()
+new Date();
ready
performance.now()
performance.now()
ready
new Date().getTime()
new Date().getTime()
ready
new Date().valueOf()
new Date().valueOf()
ready
Cached performance object
perf.now()
ready
counter
i = i + 1;
ready
pNow()
pNow()
ready
dNow()
dNow()
ready

Revisions

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