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.
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
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.