UTCParser drawback

JavaScript performance comparison

Test case created by bhorn

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    function dateFromUTC(localTime) {
      var dateTimeComponents = localTime.split(" ");
      var dateComponent = dateTimeComponents[0].split("-");
      var timeComponent = dateTimeComponents[1].split(":");
      return new Date(parseInt(dateComponent[0]), parseInt(dateComponent[1]) - 1, parseInt(dateComponent[2]), parseInt(timeComponent[0]), parseInt(timeComponent[1]), parseInt(timeComponent[2]));
    }
};
</script>

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Base
var datebase = new Date('2008-03-13 12:18:00');
pending…
Parser
var dateparser = dateFromUTC('2008-03-13 12:18:00');
pending…

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

Compare results of other browsers

0 comments

Add a comment