Date equality comparison (v5)

Revision 5 of this benchmark created on


Setup

var from = new Date(1900, 0, 1).getTime();
    var to = new Date(2100, 0, 1).getTime();
    function getRandomDate() {
        return new Date(from + Math.random() * (to - from));
    }
    
    var d1 = getRandomDate()
    var d2 = getRandomDate()

Test runner

Ready to run.

Testing in
TestOps/sec
d1.getTime() < d2.getTime()
d1.getTime() < d2.getTime()
ready
+date
+d1 < +d2
ready
d1 - d2
d1 - d2
ready
Number(d1) < Number(d2)
Number(d1) < Number(d2)
ready
d1 < d2
d1 < d2
ready

Revisions

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