Momentjs cached format functions

JavaScript performance comparison

Test case created by Tim Wood

Preparation code

<script src="https://raw.github.com/timrwood/moment/1.6.2/moment.js"></script>
<script>
window.moment162 = moment;
</script>

<script src="https://raw.github.com/timrwood/moment/b098adf2325bd62b1ca42debb7287492d7874a3e/moment.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:

1 comment

mario sanchez commented :

MomentsjslangMarioJohnSanchez

Add a comment