Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-39443 META: OU Moodle 2.4 performance tuning
  3. MDL-39452

html_writer::attribute has unnecessary is_array check

    XMLWordPrintable

Details

    • Sub-task
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.4.3, 2.5
    • 2.4.4
    • Libraries
    • None

    Description

      The html_writer::attribute function is called thousands of times on typical pages (1,271 times on the one I'm testing, to be exact).

      This function includes a check, with developer debug warning, for if some idiot passes an array for the attribute value.

      Since the check has been there since html_writer was invented (actually before), I think people should really have noticed the developer debug warning now, and this code should be removed.

      According to my profiling this check adds ~2ms to a page load on OU systems. Not a lot but a pretty big chunk just for a never-used dev debug warning.

      (Note: I'm totally in favour of dev debug checks usually, just not in functions that are called thousands of times on many pages across the system.)

      Attachments

        Activity

          People

            quen Sam Marshall
            quen Sam Marshall
            Dan Poltawski Dan Poltawski
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Jason Fowler Jason Fowler
            David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              13/May/13