Profiling
Profiling your shop’s performance
Overview
Speed is important for every website. If a website takes a long time to load, it can have a negative impact on user experience, site traffic, and SEO. Sites that are optimized for performance have big advantages over slow sites. This is why it is important to speed test your store before you launch it.
Smartstore includes a tool to measure the time from the initial request to the first byte sent to the browser (Time to First Byte or TTFB): MiniProfiler.
MiniProfiler
MiniProfiler is a library and user interface for profiling your application. By letting you see where your time is spent, what queries are running, and any other custom timings you want to add, MiniProfiler helps you debug problems and optimize performance.
The default setup of MiniProfiler is to display a widget in the top left corner of every page. This keeps performance in the forefront of your mind.

Activating MiniProfiler
The MiniProfiler is part of the Developer Tools module, which is installed and enabled by default.
To activate profiling and display the widget, go to Plugins / Developer Tools in the admin area and check the Enable MiniProfiler checkbox. Only users with Administrator role can see the profiler widget.
Exclude paths from profiling
By default, the profiler ignores the following path prefixes:
/admin/
/bundle/
/css/
/images/
/js/
/media/
/taskscheduler/
/themes/
To customize this ignore list, simply edit MiniProfiler ignored paths and separate each entry with a comma. You can profile backend pages by removing the /admin/ entry and saving the setting.
Custom timings
The profiler widget displays timings for:
controller actions
filters
view resolution & rendering
view component execution
database queries
app specific but important metrics
To hook into profiling use the IChronometer
service to find out how much time a custom code block took to execute.
The
StepStart
method starts a new timer with a key and a message to display in the widgetStepStop
stops the timerThe
Step
extension method makes usage even easier because it follows the disposable pattern (the disposer callsStepStop
implicitly)
If the Developer Tools module is installed and the MiniProfiler is active, the profiler widget will display your custom timing with the given message. If the Developer Tools module is not installed, NullChronometer
takes over.
using (_chronometer.Step("Some expensive code"))
{
// ... execute some expensive code
}
Last updated
Was this helpful?