Following are few quick tips for improving your SharePoint/ASP.Net web application performance :
1. Use minified or compressed version of the JavaScript files
While referring any third party JavaScript files, try to use their release version for example if we are planning to use the jQuery in your application you should refer minified and Gzipped version (32KB)
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
instead of development version (252 KB)
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.js"></script>
You can also minify and compress your js files using Visual studio extension available at
http://visualstudiogallery.msdn.microsoft.com/5469b7e2-90d7-4f54-b299-ae47e26323e6
You can install it in visual studio and at the time of development it self it get compressed. So you can refer the compressed version on your pages.
2. Using Script manager to composite the JavaScript files
If you are using ASP.NET AJAX in your application, you can create a composite script automatically by using the ScriptManager control. To combine scripts, add the CompositeScript element and list the script references in the order that you want them included in the composite script.
<asp:ScriptManager ID="ScriptManager1" runat="server"> <CompositeScript> <Scripts> <asp:ScriptReference Path="~/Scripts/Script1.js" />
<asp:ScriptReference Path="~/Scripts/Script2.js" /> <asp:ScriptReference Path="~/Scripts/Script3.js" /> </Scripts> </CompositeScript> </asp:ScriptManager>
You can find more details about it at -
http://msdn.microsoft.com/en-us/library/cc488552%28v=vs.90%29.aspx
Recently tried to do this in a SharePoint 2010 environment but the result was a new request to ~SiteCollection/ScriptResource.axd, and it returning a 401 Unauthorized header. Any solution to this dilemma?
ReplyDelete