-
Improvement
-
Resolution: Fixed
-
Minor
-
2.2.6, 2.3.3, 2.4
-
MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
-
MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
-
MDL-36761_loop -
In the function "apply_limit_rules()" in "/lib/grade/grade_category.php", the "count()" function is called repeatedly on a variable that does not change. For large data sets, this can cause an performance hit.
Consider changing so that count is called only once:
From:
$i = 1;
|
while ($originalindex+$i < count($grade_keys)) {
|
$possibleitemid = $grade_keys[$originalindex+$i];
|
$i++;
|
...
|
To:
$i = 1;
|
$gradekeycount = count($grade_keys);
|
while ($originalindex+$i < $gradekeycount) {
|
$possibleitemid = $grade_keys[$originalindex+$i];
|
$i++;
|
...
|