Generate

JavaScript performance comparison

Test case created

Preparation code

<script src="https://rawgithub.com/moment/moment/2.2.1/min/moment.min.js"></script>
<script>
Benchmark.prototype.setup = function() {
    dateFormat = 'DD/MM/YYYY';
    var dates = [];
    var startDate = moment();
    for (var i = 0; i < 30; i++) {
    dates.push(moment(startDate).add('days', i).format(dateFormat));
    }
};
</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
generate
for(var i = 0; i < 30; i++) {
moment(dates[i], dateFormat);
}
pending…
iterate
for(var i = 0; i < 30; i++) {
var x = startDate.format(dateFormat);
startDate.add('days', 1);
}
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