Compare dates (v2)

Revision 2 of this benchmark created on


Setup

var a = new Date(2013, 11, 12, 1, 2, 3);
var b = new Date(2013, 11, 12, 1, 2, 3);

Test runner

Ready to run.

Testing in
TestOps/sec
plus trick
var equal = +a === +b;
ready
getTime
var equal = a.getTime() === b.getTime();
ready
Subtract
var equal = (a - b) === 0;
ready
Compare with <= and >=
var equal = a <= b && a >= b
ready
Compare with < and >
var equal = !(a < b || a > b)
ready

Revisions

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