This quick "mini test suite" allows you to easily collect server-side performance metrics for WordPress core development. It does so by utilizing the Server-Timing header.
- Paste the code from
main.php
into pretty much anywhere in WordPress core, e.g. intowp-includes/default-filters.php
. - Use code like the one in
example.com
around any code or a specific function that you want to record metrics for.- All timing metrics should be float, in seconds. They will automatically be converted to milliseconds for output.
- Other metrics (e.g. function or method call counts) should be integer.
- You can test that the metrics show up correctly by loading WordPress in the browser and using
performance.getEntries()[0].serverTiming
in the Developer Console. - Use the
GoogleChromeLabs/wpp-research
repository, specifically itsbenchmark-url
command, to trigger a number of requests against the URL, and return the median Server-Timing values for all requests made. For example like this (for 10 requests, and output as CSV):npm run research -- benchmark-url -u http://localhost:8889 -n 10 -o csv
- You can copy the CSV output into a spreadsheet to easily share it with other people.