Date equality comparison

JavaScript performance comparison

Test case created by

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  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()

};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
d1.getTime() === d2.getTime()
d1.getTime() === d2.getTime()
pending…
+date
+d1 === +d2
pending…
d1 - d2
d1 - d2
pending…
Number(d1) === Number(d2)
Number(d1) === Number(d2)
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.

0 Comments