renderView and runEvent performance

Essentially what we have is a list view and an item view which is being looped over within the list view. The item view is used in other places besides the list view which is why it is its own view rather than being part of the list view. Looping over our items in the list view and calling runEvent for our items ends up taking about 420ms. When we cut the runtEvent and renderView methods out of the equation this time dropped to 23ms, which is a lot closer to what we want. Even when we cut just the runEvent method out of the process and called only the renderView method the time was only cut in half, somewhere around 200ms.

I took all interceptors out of the equation and I am using prepostExempt on the runEvent and renderView methods just to debug the issue. So interceptors are not adding extra time.

Something I noticed is that the times reported by ColdBox Debugging Information panel are not very accurate. According to the panel all of the views are rendering in or under 1ms and the runEvent’s are executing in or under 10ms. However, when I put timers around those method calls the views are actually taking 10 times as long to render (10-11ms) and the events are taking twice as long to execute (20-23ms). When I take everything the event and view are doing and put them directly in the loop (using savecontent and include rather than renderView) each loop iteration takes less than 1ms.

Is there a better approach for this kind of view reuse? How can we at the very least make the renderView method quicker? This finding in general raises some concern for us about the general performance of ColdBox for our App. It seems reasonable to me for the framework to add some time to my requests but to cause them to take 20-30 times longer is not acceptable. So I have to think we are either missing something for doing something wrong. Any ideas would be greatly appreciated.

Sorry. I am running ColdBox 3.8.0

AJ,

We have done tremendous improvements in rendering and running events in ColdBox 4. Can you verify your behavior on CB4 please.

Luis Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com
P/F: 1-888-557-8057
Direct: (909) 248-3408

ColdBox Platform: http://www.coldbox.org

ContentBox Platform: http://www.gocontentbox.org
Linked In: http://www.linkedin.com/pub/3/731/483

Social: twitter.com/ortussolutions | twitter.com/coldbox | twitter.com/lmajano | twitter.com/gocontentbox

A few quick questions:

  • Have you tried this on ColdBox 4. There’s a lot of stuff taken out of the core and it’s faster. Luis upgraded a client last week and saw a 4x improvement
  • Have you tried using a rendering collection where you call renderView() and pass it a collection to use? http://wiki.coldbox.org/wiki/WhatsNew:3.1.0.cfm#Rendering_Collections This is really the ideal way to do stuff like this.
  • What does Fusion Reactor say the request is doing during execution. Are there any big bottlenecks you can identify?

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Hi AJ,

The following documentation links will help you in rendering collections
http://wiki.coldbox.org/wiki/Layouts-Views.cfm#Rendering_Collections

Also when calling coldbox method, as each request have life cycle to complete.
http://wiki.coldbox.org/wiki/RequestLifecycles.cfm

For example renderview also calls interceptor points

// Announce preViewRender interception
// Post View Render Interception point

All, thanks for responding so quickly.

I am not currently using the collection functionality because we are returning the individual rendered strings as values in a collection if the request is made via Ajax. I will try rendering as a collection when it is not an Ajax request and see if that helps but it doesn’t resolve the issue for the Ajax request.

Sana, as I mentioned I have removed the interceptors as a culprit in this situation.

As far as trying ColdBox 4, after reading the Compatibility document it is going to take me a while to get our App running on 4.0. We have not incorporated CommandBox into our environment yet since it does not yet have a stable release, and it looks like Command Box is going to be the easiest way to get all of the non-core modules that our application relies on.