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

Performance improvement for competency framework importing

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.2
    • Fix Version/s: None
    • Component/s: Competencies
    • Labels:
    • Affected Branches:
      MOODLE_32_STABLE

      Description

      During the development of MDL-57292 was detected the process of mapping children competencies to parents is very expensive and could be optimised.

      At the moment the code is looping over $this->flat, and checking each value for a parentage match, it then calls add_children recursively for each child.
      Essentially this means that you have an n^2 loop over each component.

      Since we're only comparing the parentidnumber, we can do this easily and more efficiently by:

      1. using array_map to fetch the parentidnumber for each row in the file (stored by index)
      2. use array_keys with it's $search param to find any indexes which use that parentidnumber
      3. loop over just those rows in the file

      This means that we only ever process n loops (instead of n^2) which is much more efficient.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              lameze Simey Lameze
              Participants:
              Component watchers:
              Damyon Wiese, Jean-Philippe Gaudreau, Steve Massicotte, Serge Gauthier, Issam Taboubi, Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: