Telerik blogs

Why new TPF improvement?

Knowing that the faster an application loads, the better the overall User Experience is, we put serious efforts in optimizing our presentation framework as much as possible. Since Q3 2009, RadElement, the smallest visual unit in Telerik Presentation Framework (TPF) has been given its own lifecycle. The major benefit of this new improvement is significant boost during the loading and disposing stages. Simple tests prove that controls load and dispose between 50% up to 300% faster, depending on the depth of the corresponding element tree, hosted on each control.

Some Technical Stuff

A RadElement instance may now enter the following states:

Constructing:
The element is in a process of being constructed. Layout operations are forbidden and Property Notifications are not raised.

Constructed:
The element has already been successfully constructed and its child elements created. Layout operations are forbidden and Property Notifications are allowed.

Loading:
The element is in a process of being loaded. Layout operations are not allowed.

Loaded:
The element has already been successfully loaded. An element is considered “Loaded” when the owning RadControl’s handle has been successfully created and the control may be visualized on the screen. At this stage all layout operations as well as property notifications are allowed.

Unloaded:
A special state, which indicates that the element has been successfully, loaded one or more times but now it either does not resides in a valid element tree or its owning RadControl does not have a handle created. Layout operations are not allowed.

Disposing:
The element is in a process of being disposed of. All layout operations and Property Notifications are forbidden.

Disposed:
The element has already been successfully disposed of and may not be used further, otherwise ObjectDisposedException will be thrown.

Simple Performance Tests

To measure the actual benefit of this improvement, we have performed several simple tests, which do nothing but create several hundred instances of a given control type – e.g. RadButton and measure the time needed to accomplish the task.

Here are the results for:

200 Buttons:
image
As you can see, the loading time boost here is nearly 3,5 times or about 350%

100 Grids:
image
The boost here is less but is still significant – about 40%

100 Ribbons:
image
We are experiencing about 20% better loading time here.

Usability and Extensibility

And last but not the least comes the fact that the new lifecycle offers easy to read and understand yet flexible to extend methods and entry points, which allow developers to completely override any behavior at any stage. Such methods are:

OnLoad – implements element’s load semantic.
OnLoaded – notifies the element that it has been successfully loaded.
OnUnload – implements the core unload semantic.
OnUnloaded – notifies the element that is has been successfully unloaded from its previous element scene.
OnElementTreeChanged – provides convenient way for inheritors to add custom logic upon element tree change.
OnParentChanged – provides convenient way for inheritors to add custom logic upon parent change.
UpdateReferences – implements the core semantic of caching references to the current element tree and layout manager as well as update of some parent-dependent values such as tree level, inheritable element state, etc.

Further improvements

Well, we are planning some other TPF optimizations, which will boost both loading time and overall performance but we will keep them in secret until they are complete :-) So, stay tuned.


Comments

Comments are disabled in preview mode.