As part of an overall effort to optimize HTTP-related
performance of Web.UI, version 2007.2 includes a new mechanism for reducing the
overhead of client script deployment. Since the script files themselves are of
manageable size, and drastically benefit from compression in many cases, the
biggest overhead comes from HTTP round-trips. Each Web.UI control typically
depends on anywhere from one or two to several script files, so the number of
separate requests can affect the load times in a web application.
The ComponentArt ScriptHandler, a new feature of Web.UI
2007.2 can be used to dramatically increase the efficiency of this aspect of
Web.UI, pushing it to its theoretical limits.
With ScriptHandler, you have the ability to do choose
between three different ways of sending ComponentArt client scripts to the
client in your web application:
1. Status
quo
By default, script rendering will work exactly the same way
it has until now. Each control will output its own set of scripts or register
them with the ASP.NET AJAX ScriptManager. In the latter case, the scripts will
get compressed by default, but the overhead of multiple HTTP requests will
remain.
2. Output
the entire Web.UI client library in one request
The new script deployment mechanism allows you to combine
all Web.UI client script libraries into one and send them to the client as one
chunk. This minimizes the number of HTTP requests (to a single one), and
maximizes the benefits of compression. As of version 2007.2, the combined size
of all client scripts, compressed, is 327 KB. Due to browser caching, this
means that the Web.UI scripts will get loaded all at once, and only the first
time a user visits the site.
To enable this feature, simply add the following two entries
to your web application’s web.config file:
in <httpHandlers>:
<add
type="ComponentArt.Web.UI.ScriptHandler,ComponentArt.Web.UI"
path="ComponentArtScript.axd" verb="*"/>
in <appSettings>:
<add
key="ComponentArtScriptControls" value="All" />
3. Output
combined scripts of select controls in one request
If the size of the one-time download in option 2 is a
concern, it can be further optimized by excluding from the download those
controls which are never used in your web application. For instance, if you
only use Grid, TreeView and Menu in your application, you can change the
appSetting to
<add
key="ComponentArtScriptControls" value="Grid,TreeView,Menu"
/>
This will cause the Web.UI framework to combine all the
scripts on which these three controls depend on into one chunk, and send it to
the client compressed, and in a way which promotes indefinite client-side
caching. For the above controls, the download size would be 90 KB.
Note again that this is an application-wide setting, so the
list of controls should include any ComponentArt controls that are used
anywhere in the application.
This feature is available for preview now, in the Beta 2
build of Web.UI 2007.2. We hope you find it useful, and that it helps you
squeeze that extra bit of performance out of our control suite and your
website.