Date equality comparison (v2)

Revision 2 of this benchmark created on


Description

added getISOTime as it is relevant to my testing.

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.toISOString() === d2.toISOString
d1.toISOString() === d2.toISOString()
ready

Revisions

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