Debian Codegraph @

maintenance/benchmarks/README.md

raw symbols SCIP
1 This directory hold several benchmarking scripts used track performances of
2 MediaWiki and/or PHP.
3
4 ## Consistency
5
6 To gain greater precision than the time elapsed as reported by the benchmark
7 itself, one can use the `perf_events` tool on Linux to count the number of
8 CPU instructions, in addition to measuring how long it took to execute them.
9
10 This should accurately tell you how much machine code is executed. Note that
11 this does not correctly model the cost of each instruction (especially
12 memory access).
13
14 For example:
15
16 ```
17 $ perf stat -e instructions php -d opcache.enable_cli=1 \
18 maintenance/benchmarks/benchmarkEval.php --code="Html::openElement( 'a', [ 'class' => 'foo' ] )" \
19 --inner=1000 --count=10000
20
21 eval:
22 count: 10000
23 rate: 590.1/s
24 total: 16946.61ms
25 mean: 1.69ms
26 ...
27
28 Performance counter stats for 'php maintenance/benchmarks/..':
29 83651088078 instructions
30 17.225255198 seconds time elapsed
31 ...
32 ```
33
34 ## Fixtures
35
36 * data/tidy/australia-untidy.html.gz: Representative input text for benchmarkTidy.php.
37 It needs to be decompressed before use.
38 * data/CommentFormatter/rc100-2021-07-29.json: Input for Linker::formatComment() from
39 https://en.wikipedia.org/w/api.php?action=query&format=json&list=recentchanges&rcprop=title%7Ccomment&rclimit=100