Debian Codegraph @

devel-docs/performance_tracking.rst

raw
1 Performance tracking
2 ====================
3
4 This project is suitable for a few months of work, like an Outreachy
5 or Summer of Code internship.
6
7 As of 2022/Sep, there is no infrastructure to track librsvg's
8 performance over time. At different times there are efforts to reduce
9 the memory consumption of certain parts of the code, or to make them
10 faster, but there is no monitoring of how the library is doing as its
11 code evolves.
12
13 Given a set of example files (which can change over time), it would be
14 nice to track the following measurements over time:
15
16 - Maximum heap usage during loading and during rendering.
17
18 - CPU time for loading; CPU time for rendering.
19
20 These would let us answer questions like, is librsvg using more or
21 less memory over time? More or less CPU time? Can we detect
22 regressions with this tool?
23
24 Getting the actual measurements is not terribly hard; just running
25 ``/usr/bin/time rsvg-convert car.svg > /dev/null`` already produces a useful
26 big-picture view of things:
27
28 ::
29 $ /usr/bin/time rsvg-convert car.svg > /dev/null
30 0.90user 0.07system 0:01.10elapsed 88%CPU (0avgtext+0avgdata 39460maxresident)k
31 224inputs+0outputs (5major+6646minor)pagefaults 0swaps
32
33 The hard part is the logistics of accumulating the reports over time,
34 and graphing them. This is your project!
35
36 Goals
37 -----
38
39 - Given a librsvg commit, extract performance metrics for a corpus of
40 test files.
41
42 - Store those metrics somewhere, preferably in gnome.org.
43
44 - Plot the metrics over time. The plot should make it easy to jump to
45 a particular commit, so that we can do, "memory usage increased
46 considerably at this point; which commit is responsible?".
47
48 Questions to be researched by the intern
49 ----------------------------------------
50
51 - Gathering a set of interesting documents to keep around for regular
52 testing; `Featured Pictures from Wikimedia Commons
53 <https://commons.wikimedia.org/wiki/Category:Featured_pictures_on_Wikimedia_Commons_-_vector>`_
54 is a good source. Ask the maintainer for more!
55
56 - Is CPU time an accurate measure, even with busy CI runners? Or does
57 this need a "quiet" machine? Do small files that get rendered very
58 quickly need to be measured by averaging several runs?
59
60 - Maintaining a history of measurements, probably keyed by commit id
61 and document. Where do we keep that data? In a git repo? Or in a
62 web service - can we host it at gnome.org? In the maintainer's
63 laptop? "Append something to a perf log file somewhere and commit"
64 -> "Run a plotting program in $somewhere's CI" is probably the
65 Minimum Viable thing.
66
67 - Notifying the performance infrastructure about a new commit to test.
68 Can we do this from the CI? Maybe with `downstream pipelines
69 <https://docs.gitlab.com/ee/ci/pipelines/downstream_pipelines.html>`_?
70
71 - `GitLab's reports of custom metrics
72 <https://docs.gitlab.com/ee/ci/testing/metrics_reports.html>`_ look
73 cool and are displayed conveniently as part of a merge request's
74 page, but are only present in the Premium edition, not in GNOME's
75 GitLab instance. Is any of that worth exploring? Is the suggested
76 `OpenMetrics format <https://openmetrics.io/>`_ good as-is, or is it
77 overkill?
78
79 - Instant gratification: can we generate a new plot and publish it as
80 part of a CI pipeline's artifacts? Sparklines of performance
81 metrics over time, to maximize the bling/size ratio?
82
83 Inspiration, but beware of overkill
84 -----------------------------------
85
86 - `Are We Fast Yet <https://arewefastyet.com/>`_, Firefox's performance metrics.
87
88 - `WebKit Performance Dashboard <https://perf.webkit.org/>`_.
89
90 - `Rust performance page <https://perf.rust-lang.org/>`_. See the
91 README in `this repository
92 <https://github.com/rust-timer/rustc-timing>`_ for the scripts and
93 data that drive this.
94
95 Sample documents
96 ----------------
97
98 Interesting types of SVG documents to put into the performance tracker:
99
100 - Lots of objects.
101
102 - Lots of filters.
103
104 - Lots of text.
105
106 - Wikimedia Commons has good examples: `featured pictures
107 <https://commons.wikimedia.org/wiki/
108 Category:Featured_pictures_on_Wikimedia_Commons_-_vector>`_, `SVG by
109 subject
110 <https://commons.wikimedia.org/wiki/Category:SVG_by_subject>`_.