MiniProfiler for Umbraco
MiniProfiler for Umbraco is based on the http://miniprofiler.com/ from Sam Saffron and will help you to profile your macros and your SqlServer and SqlCe.
Setup
Download the package from our.umbraco and install it.
To start profiling your macros, make sure the setting "EnableMiniProfiler" is set to "true" in the web.config
<add key="EnableMiniProfiler" value="true" />
and replace the <umbraco:Macro> tags for <profiler:Macro> in your templates, for example:
<%@ Master Language="C#" %><!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title><profiler:Macro Alias="PageTitle" runat="server" /></title>
<profiler:Macro Alias="HeaderTags" runat="server" />
</head>
<body>
<header>
<nav role="navigation">
<profiler:Macro Alias="Navigation" runat="server" />
<profiler:Macro Alias="SearchBox" runat="server" />
</nav>
</header>
<div class="container">
<section role="main">
<asp:ContentPlaceHolder Id="MainContent" runat="server" />
</section>
<aside role="complementary">
<asp:ContentPlaceHolder Id="SideContent" runat="server" />
</aside>
</div>
<footer class="footer" role="contentinfo">
<profiler:Macro Alias="RelatedLinks" runat="server" />
<profiler:Macro Alias="LanguageSelector" runat="server" />
<profiler:Macro Alias="SocialLinks" runat="server" />
</footer>
<script src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js"></script>
<profiler:Renderer runat="server" UseExistingjQuery="true" />
</body>
</html>
If you also want to profile your SqlServer or SqlCe, set the "EnableSqlMiniProfiler" setting in the web.config to "true"
<add key="EnableSqlMiniProfiler" value="true" />
Finally, add
<profiler:Renderer runat="server" UseExistingjQuery="true" />
Profiling Umbraco back-end
If you want to profile the Umbraco back-end, you can add this at the end of the /umbraco/umbraco.aspx page:
<profiler:Renderer Position="Right" runat="server" />
Live example
Please visit http://profiler.jlusar.es to see a live example of how it works. Notice that no macro has been cached so you can see what happens on every request. You can also have a look at the source code on https://github.com/jorgelusar/miniprofiler-for-umbraco
Performance issues on uBootstrap
When I started profiling uBootrtrap I notice that some macros such as the Navigation.cshtml where doing lots of request to the database, and the main problems was that I was using some syntactic sugar such as item.Texpages to retrieve al descendants node of type "Textpage". Then I removed that and change it for item.Descendants("Textpage") and the macro was being loaded about 8x faster and no sql calls. So if you have this sort of syntax in your razor views, I'd recommend to use .Descendants("SomeTemplate").
Thanks
- Sam Saffron for MiniProfiler
- Jörn Zaefferer for the jquery-plugin-tooltip
License
- MiniProfiler is licensed under apache 2.0 license
- jquery-plugin-tooltip Dual licensed under the MIT and GPL licenses
- MiniProfiler is licenced under MIT
Comments
It looks very promissing, thank you a lot.