The Perf Panel gives you a detailed view into how fast your page loads.
- Server - Page Execution. The time it takes to execute the script, up until it begins to send the response to the browser.
- Network - Transfer. The time it takes to send all response bytes to the browser. This will be affected by the number of bytes and the speed of your network connection.
- Server - Peak Memory. The highest amount of memory used at any point in the execution of the script. This is largely affected by reading data from files or a database.
The Perf Score is focused on the user’s perception of the speed of the page.
Research shows that after 1 second (1000 ms), users perceive an interface to be slow.
|1 - 500||FAST|
|501 - 1000||OK|
How to Activate
To display the perf panel at the bottom of every page, set
showPerfPanel: true in
Because this is a developer feature, it will only display if:
- You are running under the
- You are visiting from localhost IP (i.e. running the server locally).
- Your IP address matches
Adding Perf Tasks
You can measure the performance of your own tasks by using the Perf module.
How to Improve Performance
We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%.
— Donald Knuth
- Do not micro-optimize. Don’t worry about the difference between small things, like
a += 1vs.
a = a + 1. This leads to hard-to-maintain code and rarely makes a noticeable difference.
- Think in human scale, not computer scale. Going from 2 nanoseconds and 1 nanosecond might be a 100% speed gain, but is unnoticeable to humans. If you are benchmarking code by looping it 1 million times, the difference is probably too small to matter. Most page requests don’t run any single operation more than, say, 100 times.
- Instead, find the bottlenecks. This is the “hot path” — a single block of code that takes the biggest chunk of time. The Perf Panel will show you which tasks are taking the longest. You can add new tasks to the list using the
- The most common bottleneck is a database query. The most effective solution is usually to cache the query results.
- Take an honest look at whether including 3rd party social and analytics widgets is worth the extra bloat. Try to remove anything that isn’t truly necessary. This is more important than ever, now that the majority of browsing happens on mobile devices.
- If it ain’t broke, don’t fix it. It’s tempting to constantly tweak performance. But if you’re already getting sub-second load times, you can probably move on to other tasks.
This section checks for un-optimized images in your Document Root.
See Image Optimization.
You will have optimal performance with the following:
- PHP: Version 7.0+ (Recommended: 7.3+)
- Opcode Cache: OPCache or APC. This prevents PHP from re-compiling the code on every request.
- App Cache: TBD. The driver for storing values from
Cache.set()is currently file-based. Eventually this will support memcache and APC.