JavaScript performance comparisons (was Re: Dear moodle, can we stop having the YUI lib yet?)

Moodle JS performance

by sam marshall -
Number of replies: 0
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Mauno - interesting stats. My question (not for you, in general) is why is it loading those JS and CSS files - a typical moodle pageload should make 0 JS and 0 CSS http requests because all those files should be in cache. Definitely this should be true within a session but it should also be true (or nearly true) between sessions if you haven't cleared browser cache. If it isn't true, especially in a session, then this would be why performance is poor.

This could be a problem with the analysis tool you are using or it could be a genuine problem. [One thing to bear in mind: turning on debug options like theme designer mode, etc, explicitly kills cacheing. It's ok if it makes way too many requests with debug options so there is no point looking at performance on dev servers unless you know you turned those options off.]

Regarding TinyMCE performance there is no real problem with TinyMCE performance in Chrome or Firefox (and IMO the problem with 20+ copies of TinyMCE is more a problem for the pages that have kind of bad user interface). Where there is a problem is in IE7 and to a lesser extent IE8 - and this problem exists there with 1 copy of TinyMCE, or is much worse with 2 copies, with 10 it's horrific...

Just a general point about AJAX and JS support - I think there's a real and severe risk of making the interface worse with AJAX (as happens if you turn it on for Moodle course pages). 'Keep it simple, stupid' is a good design principle for projects that don't have a very strong design lead. If you look at real-world AJAX use there are some great examples but if you look at it on smaller sites there is also a lot of horrible junk out there.

I think in Moodle it would be very helpful for usability if any AJAX use focuses strongly on progressive enhancement that does not majorly change the interface over the non-JS version. (Like, a search box where it updates in the page when you search instead of having to load a whole new page; that kind of thing that makes it better but isn't an obvious change.)

--sam