Date.now vs Date.valueOf vs Number(Date)
JavaScript performance comparison
Info
Add +new Date() to the existing tests against Date.now, new Date.getTime() and Number(new Date)
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
Date.now() |
|
pending… |
Date.getTime |
|
pending… |
Number( new Date) |
|
pending… |
+new Date() |
|
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:
- Revision 1: published by Will Alexander
- Revision 2: published by Kristof Neirynck
- Revision 3: published
- Revision 4: published
- Revision 5: published
- Revision 6: published
1 comment
FYI, there was already a test case for this; see http://jsperf.com/new-date-value and revisions.