Momentjs cached format functions

JavaScript performance comparison

Revision 4 of this test case created

Preparation code

<script src="http://momentjs.com/downloads/moment.min.js"></script>
<script>
window.moment162 = moment;
</script>

<script src="http://momentjs.com/downloads/moment.min.js"></script>

<script>
if (window.console) {
console.log('moment162', moment162().format('dddd, MMMM Do YYYY, h:mm:ss a'));
console.log('moment', moment().format('dddd, MMMM Do YYYY, h:mm:ss a'));

console.log('moment162', moment162().format('LLLL'));
console.log('moment', moment().format('LLLL'));
}
</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
normal long
moment162().format('dddd, MMMM Do YYYY, h:mm:ss a');
pending…
cached long
moment().format('dddd, MMMM Do YYYY, h:mm:ss a');
pending…
normal small
moment162().format('MM-DD-YYYY');
pending…
cached small
moment().format('MM-DD-YYYY');
pending…
normal local
moment162().format('LLLL');
pending…
cached local
moment().format('LLLL');
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. Here’s a list of current revisions for this page:

0 comments

Add a comment