We've noticed that performance loading the course page when using our custom course format is poor compared to the standard ones.
I originally assumed this would be related to the extra web service requests, but actually these seem to respond quite fast and more of the time is spent in script execution. Looking at the profile results in Chrome, so far as I understand them, it mainly seems to boil down to calls to CoreCompileProvider.createAndCompileComponent - there are several of these calls which sometimes get up to 2 seconds on one test course, although more usually are about 400ms.
The course format has a relatively complicated Angular template, but we think it is (or could be) the same for every course, i.e. the CUSTOMDATA is different but the template is unchanged. So it would be nice if we could get it to compile once instead of every time. Because of browser JITs, it's possible that in addition to saving the time compiling the template, if the compiled version were reused then it might run faster the second time around.
, but I'm not sure how...
a) Could we return a template from the init call, so it gets compiled once, and then somehow use this template for the course page instead of supplying a new 'main' template every time?
b) The 'main' template uses a bunch of sub-templates like this:
<ng-template #eventList let-events="events">
Is there a way to remove these from the 'main' template and instead reference ones we've returned from the init call, again possibly getting a performance boost?
Or does anyone have other ideas for making our template performance suck less?