Monday, July 8, 2013

Performance tip: Caching display method



One significant side-effect of using display methods can be the impact on performance. Particularly when complex methods are used to calculate values being shown on grids, a visible slow-down in form performance can be experienced. This is largely due to the fact that the methods are often run repeatedly even when no reason is apparent and the values are unchanged.

To alleviate this, display methods on tables can be cached by using the cacheAddMethod method of the datasource object. To enable caching of a display method, call cacheAddMethod() from the init method of the datasource. This ensures that the display will only be calculated when necessary and can result in a significant performance improvement.

 

public void init()

{

    super();

 

    // Enable caching of the document handling display fields

    dirPartyTable_ds.cacheAddMethod(tablemethodstr(DirPartyTable, primaryPhone));

}

No comments:

Post a Comment