MomentJS parse vs strftime

JavaScript performance comparison

Test case created by Tim Wood

Preparation code

<script src="https://raw.github.com/timrwood/moment/1.3.0/moment.js"></script>
<script src="http://cloud.github.com/downloads/benjaminoakes/moment-strftime/moment-strftime.js"></script>
<script>
var a = moment();
if (window.console && window.console.log) {
    console.log('moment.fn.strftime : ' + a.strftime("%m/%d/%y %I:%M %p %Z"));
    console.log('moment.fn.format   : ' + a.format('MM/DD/YY HH:mm A z'));
}
</script>
<script>
Benchmark.prototype.setup = function() {
    var a = moment();
};
</script>

Preparation code output

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
strftime
a.strftime("%m/%d/%y %I:%M %p %Z")
pending…
format
a.format('MM/DD/YY HH:mm AA z')
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