6 Mar 2003 11:47
Method info caching feedback, small performance updates
First I should explain some background. We are changing the presentation level architecture in OFBiz and instead of using JSPs we are using FreeMarker for templating, and BeanShell for the data preparation logic, triggered through BSF with JPublish coordinating things. Anyway, we started using Rhino JavaScript, but after some profiling we found out that it was really slow, so we switched to BeanShell. There was an immediate performance increase, but with a few changes I have been able to eek some more speed/efficiency out of it. One interesting thing I did was to create a custom BSF engine for BeanShell that has a custom eval method. It splits eval into a parse and execute phase, making it possible for us to cache parsed scripts. This didn't result in a huge performance increase because the BeanShell parsing is really quite good, but it did help quite a bit. I have also updated to use the latest code from CVS. I noticed that some work has been done on caching method reflection data for method invocation. In the profiling I have been doing the slowest part seemed to be the class.getMethods calls. So, I made two changes there: copied the original before changing so it could be used the second time, and I introduced a HashMap to cache Method[]s that would normally come from the class.getMethods call. This helped quite a bit with performance, but I think a little bit more work may be needed because using a HashMap like this for caching basicly assumes that the classes are constant, but bsh uses a dynamic class loader so it may not always be the case.(Continue reading)
RSS Feed