Display performance changes in widget as a percentage (%)
Problem to solve
Currently in the performance report my project have quite a few benchmarks. However to at a glace determine if there is any relevant degradation is hard. In golang benchmarks output is on the form ns/op, so we end up with
ns/op: 2147483647 (+1759776281) in Benchmark1
Determining how bad this is requires manually counting digits and its one among many benchmarks.
But even smaller more easy to read benchmarks require some effort. The below numbers are a 2% degradation which is probably within the margin of error but still requires thought to figure out.
ns/op: 256 (+5) in Benchmark1
Intended users
Anyone for whom performance is important will benefit from increased performance tracking directly or indirectly
User experience goal
Proposal
- Show performance changes in the performance report as a % as well as the regular numbers.
- So
ns/op: 2147483647 (+1759776281) in Benchmark1
would become something likens/op: 2147483647 (+1759776281) (+453%) in Benchmark1
- Where the % is (new score/base score -1)*100.
- This makes the (very severe) degradation immediately visible.
- So
Technical Proposal
The browser performance and load performance widgets both use performance_issue_body.vue
as the component to render issues, so changes we make to that file should be reflected in both widgets. We could duplicate the issueDelta
/formatScore
pattern that we already use to display the delta as a number, call the new version issueDeltaPercentage
/formatPercentage
, and use it to calculate and display the delta as a percentage of the base score.
We can use one of these formatters to do the locale-specific percentage formatting (i.e. 1,234.56%
vs 1 234,56%
) for the string that goes in the widget.
Further details
Future iterations:
- For known sitespeed (for browser performance) or K6 (for load testing) metrics we can be specific with "good"/"bad" delineation about what the change means.
- It might also be nice to be able to define performance degradations as a % but beyond the scope of this proposal
Permissions and Security
No impact
Documentation
Availability & Testing
What is the type of buyer?
Same as for the performance report
Is this a cross-stage feature?
No