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

    • Type: Sub-task
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4.3, 2.5
    • Fix Version/s: 2.4.4
    • Component/s: Libraries
    • Labels:
      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

            Assignee:
            quen Sam Marshall
            Reporter:
            quen Sam Marshall
            Peer reviewer:
            Dan Poltawski
            Integrator:
            Eloy Lafuente (stronk7)
            Tester:
            Jason Fowler
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

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