Affects Version/s: 3.8.3, 3.9
Fix Version/s: None
Affected Branches:MOODLE_38_STABLE, MOODLE_39_STABLE
Right now memory usage in the footer is reported with 1 decimal digit precision, both RAM and RAM peak:
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.
- 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:
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.