Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-39443 META: OU Moodle 2.4 performance tuning
  3. MDL-39590

Theme overridden renderers are included in an inefficient way

    XMLWordPrintable

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 2.3.6, 2.4.3, 2.5
    • None
    • Performance, Themes
    • MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • Hide

      Using a range of themes that override override renderers, have a quick navigate around Moodle to verify nothing is broken.

      Suggested themes to try:
      a. Afterburner
      b. anomaly
      c. clean (renderers are in boostrapbase)
      d. mymobile
      e. your favourite contrib theme with renderers

      Show
      Using a range of themes that override override renderers, have a quick navigate around Moodle to verify nothing is broken. Suggested themes to try: a. Afterburner b. anomaly c. clean (renderers are in boostrapbase) d. mymobile e. your favourite contrib theme with renderers

    Description

      At the moment, if a theme wants to override a renderer, it has be put that class inside theme/name/renderers.php.

      The problem with this is that to override a renderer, you have to include the original renderer class definition, so you can subclass it.

      And because renderers need to deal with the inner workings of the component they are for, component renderers often need to include lots of other class definitions.

      and so including theme/name/renderers.php is very expensive performance wise. For example, it might load all the quiz code, even if we are not doing any quiz-related code.

      So, we propose to change the logic. If the theme contains a directory renderers, containing files with names like mod_quiz_renderer.php or block_navigation_renderer.php or core_calendar_renderer.php, then we include those files, but only when required, and we don't include renderers.php.

      (In this situation, we will just ignore renderers.php, if it exists. That way, people can make third-part themes with a renderers.php, which does require_once on all the files in the renderers folder, and there theme will work with both 2.4 and 2.5.)

      If a theme does not have a renderers folder, and does have a renderers.php file, then we will require it as at present, for backwards compatibility.

      Attachments

        Issue Links

          Activity

            People

              timhunt Tim Hunt
              timhunt Tim Hunt
              Matteo Scaramuccia, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo, Huong Nguyen, Bas Brands, Mathew May, Amaia Anabitarte, Carlos Escobedo, Laurent David, Mikel Martín Corrales, Sabina Abellan, Sara Arjona (@sarjona)
              Votes:
              3 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: