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

Performance improvement for competency framework importing

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Won't Do
    • Icon: Minor Minor
    • None
    • 3.2
    • Competencies
    • MOODLE_32_STABLE

      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.

            Unassigned Unassigned
            lameze Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

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