Struts 2 OGNL s:iterator 与 JSTL c:forEach 性能对比
我最近一直在构建一些相当动态的 Web 应用程序,这些应用程序严重依赖于数据库(JPA)支持的配置。这些应用程序是多用户、多帐户系统,最终用户可以在其中基于 JPA 实体创建自定义表单。
我注意到,随着 JSP 页面变得越来越复杂,我的性能和加载时间受到了影响。最初我以为是数据层导致了我的瓶颈,但今天一时兴起,我替换了几个包含页面,这些页面是使用 struts 迭代的对象列表动态创建的,并使用基于 JSTL 的迭代方案。我惊讶地发现我的页面加载时间从大约 10 秒缩短到大约一秒。随着列表大小的增长,JSP 页面的渲染时间大幅增加(使用 struts2 OGNL 迭代)。
在我的 struts 配置中,我关闭了开发模式,并且使用了一个简单的主题集,没有什么特别的。我正在考虑重写一些迭代繁重的页面,以使用 JSTL 而不是 struts,但我想我应该四处询问一下,看看我是否遗漏了某些内容,或者是否有人遇到过类似的情况。
I've been building some fairly dynamic web applications recently that rely heavily on database(JPA) backed configurations. These applications are multi-user, multi-account systems in which the end users can create custom forms based on JPA entities.
I noticed as my JSP pages became more complex that my performance and load times were taking a hit. Originally I had thought it was the data layer causing my bottleneck, but on a whim today I replaced a couple include pages which are created on the fly using lists of objects that are iterated over by struts with a JSTL based iteration scheme. I was blown away that my page load time went from about 10 seconds to around a second. The render times of the JSP pages increase substantially (with struts2 OGNL iteration) as the list sizes grow.
In my struts configs I have dev mode turned off and I'm using a simple theme set, nothing special. I'm considering rewriting some of my iteration heavy pages to use JSTL instead of struts, but I thought I would ask around to see if I'm missing something or if anyone has run into similar circumstances.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
OGNL 相当慢;新版本将寻求进行一些性能增强。
在我看来,S2 和 JSTL 标签功能重叠,就像 S1 一样,我倾向于 JSTL。
在不了解有关实际表示层的更多信息的情况下,您采取了哪些措施来提高性能已经,或者有关主题模板的更多详细信息,很难说更多。
OGNL is pretty slow; newer versions will be looking to make some performance enhancements.
IMO where S2 and JSTL tag functionality overlap, as with S1, I lean towards JSTL.
Without knowing more about your actual presentation layer, what measures you've taken to increase performance already, or more details about what your theme templates look like, it's tough to say more.