Details

      Description

      Inspired by Tim and Sam's work, I've just been having a play with xh_prof.

      I noticed that in admin_category we use $this->category_cache to cache records.

      This is a protected variable, which is set to an array in the constructor, and also in a purge function. The only operations on it are:

      • $this->category_cache = array();
      • isset($this->category_cache[$key])
      • $this->category_cache[$key] = $value;
      • return $this->category_cache[$key];
      • while($this->category_cache)
      • array_pop($this->category_cache);

      In every function which accesses it, we still call is_array($this->category_cache) even though it is only every treated as an array.

      On a default install of Moodle with no additional plugins, the locate() function is called around about 8,600 times with up to two is_array() calls.

      By removing this, I'm seeing savings of around about 100ms on my laptop.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  14/May/13