-
Improvement
-
Resolution: Fixed
-
Major
-
3.5.8, 3.6.6, 3.7.2, 3.7.5, 3.8.2
-
MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE
-
MOODLE_39_STABLE
-
At the moment, when a question_usage is loaded from the database, the question used by each question_attempt is fully initialised by calling $question->apply_attempt_state($qa->steps[0]). https://github.com/moodle/moodle/blob/01aa126848377b5a17c0b57f3b81d1ab430dad86/question/engine/questionattempt.php#L1557
When using sophisticated question types like STACK, apply_attempt_state is necessarily quite expensive.
It might be possible to change this to a lazy-load (or rather a lazy-init), so that rather calling apply_attempt_state on-load, we call it the first time a method of question_attempt that needs the question to be initialised is called. This could be a relatively painless performance win.
See https://moodle.org/mod/forum/discuss.php?d=393058#p1585280 for the thread that lead to this idea.
- caused a regression
-
MDL-83727 Core question privacy provider incorrectly uses question attempt lazy-loading, leading to errors
-
- Closed
-