浏览 6719 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2004-04-16
引用 It's accepted knowledge that JSPs are efficient because they are monolithic, stateless, compiled Java classes.
However, like much accepted, common knowledge, it may not be correct. I've had to debug some problems in JSPs using Struts in both Tomcat and WebLogic, so I've seen the kind of code that gets generated. What I found interesting is the amount of code related to pooling JSP tag instances. The thing is, the JSP as a whole is stateless, but while the JSP is rendering, the tags within the JSP do have considerable transient state. So, each time a JSP tag is referenced in a JSP, the corresponding code obtains a pooled instance of the tag, re-initializes all its attributes, uses it ... then clears it and puts it right back into the pool. This is where Tapestry has a bit of an advantage; in Tapestry, the entire *page* is pooled, not the components within the page, so the cost of a component is relatively small. Further, the way Tapestry parameters work allows a component to identify intransient parameters ... parameters whose value doesn't change, such as with a <string-binding> or <message-binding>, or a literal value in an HTML template. In those cases, the component doesn't need to reset the property value after the component renders, or re-initialize the property value when the component is utilized again. Tapestry 3.1 will be using even smarter dynamic bytecode generation (using Javassist) to further improve the efficiency with which a component can access its parameters. OGNL will be using Javassist (or a similar library) to build more efficient access paths to object properties, as efficient as ordinary method invocations, rather than reflection. So, the optimizations (including the invariant checks), mean that Tapestry is using OGNL less ... and the OGNL improvements mean that when OGNL is used, it works more efficiently. Now all we have to do is build "equivalent" applications and start comparing. 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2004-04-16
tapestry的作者是个牛人啊, 又开始折腾hivemind了。 据说以后的tapestry会和hivemind结合起来
|
|
返回顶楼 | |
发表时间:2004-04-16
事实上Tapestry3.0已经使用Javassist进行byte code generation了,可以定义abstract的setter和getter方法,把property定义在page specification中,Tapestry会enhance这个类,自动实现getter和setter方法。
另外Tapestry3.1性能的提高主要得利与ONGL的性能提高 Howard Lewis Ship's blog 写道 That, combined with Drew's upcoming improvements to OGNL should be very exciting. Mind Bridge has profiled Tapestry applications and they can spend around 50% of their time evaluating OGNL expressions. The majority of those OGNL expressions are simple property references. They're working on a plan to make use of Javassist to replace reflection with direct method invocations where appropriate, and Drew's seen about a 10x improvement.
|
|
返回顶楼 | |
发表时间:2004-04-16
|
|
返回顶楼 | |
发表时间:2004-04-17
呵呵,taglib搞不好的话,性能还真不是一般的差啊,我自己可就是有切身体会哦
在手头的项目中把一些页面表现的元素(比较通用的,如工具栏、标签什么的)使用tag输出的,由于一开始开发时是在tomcat上,所以没发现有什么不对,可是迁移到WAS4上后,发现页面性能极差,打开一个页面往往要6、7分钟,当时感觉这个系统整个一后现代 没什么好方法,就步步逼近看看到底哪儿出的错,最后问题被定位在了这些标签上。 在tag源码中,对于那些doStart,doEnd,各地方负责的输出信息我都是直接在那些方法里out了,结果导致性能问题严重,没办法将那些输出全都放到StringBuffer里面,然后在最后一次输出,问题解决。 |
|
返回顶楼 | |
发表时间:2004-04-18
楼上举的例子不太正确吧。应该是java使用的方法不正确吧。
与taglib性能没有直接的关系。 |
|
返回顶楼 | |
发表时间:2004-04-21
但问题是包括sun提供的教程在内的基本上所有的教程都是那么教的。唉,学院派会害死人的
|
|
返回顶楼 | |