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

Performance improvement for competency framework importing

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Won't Do
    • 3.2
    • None
    • Competencies
    • 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

              Unassigned Unassigned
              lameze Simey Lameze
              Jean-Philippe Gaudreau, Steve Massicotte, Serge Gauthier, Issam Taboubi, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: