---
title: "新版Tapestry4.1.2在性能上的提升"
author: "tapestry"
date: "2007-06-27T16:13:44Z"
tags: []
slug: "tapestry4-1-2"
draft: false
lastmod: "2007-06-27T16:13:44Z"
id: 94748
url: "https://tapestry.iteye.com/blog/94748"
---

一、**ognl2.7带来的性能上的提升**
这个版本应该早就该释出的，一直在等ognl2.7版本的稳定，不过这也是值得的，ognl2.7带来性能上的提升是可观的。在Tapestry4.1.2投票的时候就测试出跟Tapestry-prop不兼容，但ognl采用了跟prop一样的javassist增强来实现，应该说ognl在性能上跟prop差不了多少了（没实际测试，只是从理论上来说），而且ognl提供了更多的功能，Tapestry4.1.x版本的prop可以放弃了（T5中已经默认为prop了，那个prop跟T4的不一样，题外话），关于prop跟ognl老版本的性能测试可以参考这里(<http://tapestryjava.blogspot.com/2006/11/improve-tapestry-performance-with.html>)，tapestry-prop主页也有对比(<http://howardlewisship.com/tapestry-javaforge/tapestry-prop/>)，新版本ognl跟旧版本的性能对比参考这里：(<http://blog.opencomponentry.com/2007/01/14/new-ognl-release-on-the-horizon-its-faster/)>。
二、**使用softReference的PagePool**
Tapestry4.x版本中有一个PagePool的bug（<https://issues.apache.org/jira/browse/TAPESTRY-1151>），就是PagePool的实现没有移除Idle的Page实例，虽然很方便通过重新实现PagePool并覆盖官方实现来修正（<http://tapestry.iteye.com/blog/35221>），但毕竟是bug，4.1.2已经采用了使用softReferences的Commons Pool，并且可以配置(<http://tapestry.apache.org/tapestry4.1/developmentguide/performancetuning.html>)。
三、**Asset caching**
在Tapestry中图片、javascript文件、css文件都叫做Asset，这些都可以被浏览器cache了，并且使用gzip压缩
（<http://blog.opencomponentry.com/2006/12/03/gzip-where-have-you-been-all-my-life/>），加快了传输速度。
四、**使用layered build system提升dojo的加载速度**
Tapstry4.1中集成了dojo来实现ajax功能，4.1.2中集成了dojo0.4.3的最新版本，使用new layered build system增加了整个页面的加载速度。

    其它还有许多的内存消耗等方面的改进，总起来说Tapestry4.1.2在性能上已经有了很大的提升。