Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-23754 Performance improvements META
  3. MDL-25637

count/sizeof calls are slow for big arrays. Reduce them whenever possible.

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: None
    • Component/s: Performance
    • Difficulty:
      Moderate
    • Affected Branches:
      MOODLE_20_STABLE

      Description

      there are places where we can find:
      for($i = 1; $i < sizeof($data); $i++) {...

      these should really be
      $datasize = sizeof($data);
      for($i = 1; $i < $datasize; $i++) { ...

      this doesn't apply to places where the loop condition expression on both sides of the expression are dynamic.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: