19.3. Performance Programming Techniques

Aside from the different caching options available in Publishing sites, and techniques to minimize the page size returned to the requester, custom code is likely to be the area where the biggest performance improvement can be realized. Custom code is typically where most of the performance issues arise in SharePoint applications because developers are not aware of the inner workings of the .NET Framework or some of the nuances in the SharePoint API.

This section explains some of the more common issues that arise from Publishing sites in the area of working with the SharePoint API. These concepts apply to any custom code written in SharePoint sites — not just Publishing sites or MOSS 2007 sites, but any WSS 3.0-based site. In fact, these concepts go all the way back to WSS 2.0!

19.3.1. .NET Framework Disposable Objects

Before explaining the specifics of disposable objects within the context of the SharePoint API, developers must first understand what it means in general .NET terms. One of the core capabilities the .NET Framework provides developers is managing system memory. This is what gives .NET applications the label "managed" applications — the applications typically do not manage their own memory; instead, the .NET Framework does it for them.

.NET applications create objects that consume memory. These include objects such as integers, strings, and classes, to name a few. After an object is created, developers do not have to explicitly ...

Get Professional SharePoint® 2007 Web Content Management Development: Building Publishing Sites with Office SharePoint Server 2007 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.