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


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

      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.)

            quen Sam Marshall
            quen Sam Marshall
            Dan Poltawski Dan Poltawski
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Jason Fowler Jason Fowler
            1 Vote for this issue
            4 Start watching this issue


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