Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-69045

Increase precision of memory reported by get_performance_info()

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.8.3, 3.9
    • Fix Version/s: None
    • Component/s: Performance
    • Labels:
      None
    • Affected Branches:
      MOODLE_38_STABLE, MOODLE_39_STABLE

      Description

      Right now memory usage in the footer is reported with 1 decimal digit precision, both RAM and RAM peak:

      RAM: 6.6MB
      RAM peak: 7.6MB
      

      While this is generally ok, it's not enough, specially when talking about small sizes. We have detected this when running performance comparisons (jmeter) and just a few bytes can lead up to a "100Kb" of difference reported.

      Real case:

      • run1: memory used (in bytes) = 5190346
      • run2: memory used (in bytes) = 5190452
      • real difference = 106 bytes

      These are reported by get_performance_info(), internally using display_size() as:

      • 4.9MB
      • 5MB

      And that's 0.1MB (102KB, 104448 bytes!) when the real difference was just 106 bytes. Or, in other words, it's more than a 2% of increase reported, firing all the performance alarms.

      So we need more precision here, surely 2 digits are enough, though the more, the better.

      This can be achieved in 3 ways:

      0) Moving away from the display_size() function.

      1) Changing the display_size() to always provide more precision.

      2) Adding an optional param to display_size(), called $precision, defaulting to current 1, and make the calls from get_performance_info() to ask for more.

      Ciao

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            stronk7 Eloy Lafuente (stronk7)
            Participants:
            Component watchers:
            Matteo Scaramuccia, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: