Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-62752

Probable performance bug in get_available_completion_tabs / can_edit_bulk_completion

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 3.3.6, 3.4.3, 3.5
    • Activity completion
    • MOODLE_33_STABLE, MOODLE_34_STABLE, MOODLE_35_STABLE

      get_available_completion_tabs is called on every page, as part of settings_navigation::initialise. This uses get_available_completion_tabs so that the bulkcompletion tab shows up if you have moodle/course:manageactivities capability in the course, or in any activity that you can see. It is implemented in a way that is very efficient if you do have that capability.

      Unfortunately, most users are students who do not have that capability, so this is the common case, and this seems to be quite inefficient if you have a large course. It ends up calling $mod->uservisible && has_capability('moodle/course:manageactivities', $mod->context) for every activity in the course, and this is taking 0.29 seconds out of a 1.19 second page-load in my load testing. This is is on any page I look at in this example course containing 700 activities/resources. It is making 1400 calls to cm_info::__get (2/3 of the time) and 685 calls to has_capability (1/3 of the time).

      If we coud save that much on every page-load, it would be a big win.

      I have not tried, but I imagine this can be reproduced by creating a medium or large course with System administration > Development > Make test course, and then examining performace of the course page when logged in as a student.

            Unassigned Unassigned
            timhunt Tim Hunt
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.