You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Matthew Seaborn <Ma...@performgroup.com> on 2009/02/14 17:12:15 UTC

How can you get OGNL to go faster?

I am currently running Struts 2.0.11 (planning to upgrade soon) with OGNL 2.6.11 and am having significant trouble with the appalling performance of OGNL.

The following XML using Struts 2 Tags and ORNL takes (using the s2 profiling) 2328ms to render

<%@ page contentType="text/xml" %><%--
--%><%@ taglib prefix="s" uri="/struts-tags" %><%--
--%><%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %><%--
--%><?xml version="1.0" ?>
<response>
      <entities>
            <s:iterator value="entities" id="entity">
                  <entity <%--
                  --%>id="<s:property value="id"/>" <%--
                  --%>name="<s:property value="name"/>" <%--
                  --%>externalId="<s:property value="externalId"/>" <%--
                  --%>color="<s:property value="renderColor"/>" <%--
                  --%>image="<s:property value="image.path"/>" <%--
                  --%>includeInKey="<s:property value="includeInKey"/>" <%--
                  --%>orderRank="<s:property value="orderRank"/>" <%--
                  --%> />
            </s:iterator>
      </entities>
</response>

The exact same functionality, using JSTL tags and EL, takes 15ms

<%@ page contentType="text/xml" %><%--
--%><%@ taglib prefix="s" uri="/struts-tags" %><%--
--%><%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %><%--
--%><?xml version="1.0" ?>
<response>
      <entities>
            <c:forEach items="${entities}" var="entity">
                  <entity <%--
                  --%>id="<c:out value="${entity.id}"/>" <%--
                  --%>name="<c:out value="${entity.name}"/>" <%--
                  --%>externalId="<c:out value="${entity.externalId}"/>" <%--
                  --%>color="<c:out value="${entity.renderColor}"/>" <%--
                  --%>image="<c:out value="${entity.image.path}"/>" <%--
                  --%>includeInKey="<c:out value="${entity.includeInKey}"/>" <%--
                  --%>orderRank="<c:out value="${entity.orderRank}"/>" <%--
                  --%> />
            </c:forEach>
      </entities>
</response>

In this case the S2/OGNL is 150x (!!!!!) slower than the standard approach.  Now clearly in this case I can simply use the JSTL/EL approach to get decent performance, but when using S2's Freemarker based tags I don't get that option.

Is this really as fast as OGNL can go, or there some optimisation/option I am missing?

Does anyone know how much faster is OGNL 2.7 supposed to be?

Matthew Seaborn
Software Architect
t    +44(0) 208 484 0729
m  +44(0) 7949 465 142
e   matthew.seaborn@performgroup.com<ma...@performgroup.com>


[cid:image001.jpg@01C98EBB.797B1DB0]<http://www.performgroup.com/>
Sussex House
Plane Tree Crescent
London, TW13 7HE
United Kingdom
www.performgroup.com<http://www.performgroup.com/>



 [cid:image002.gif@01C98EBB.797B1DB0] <http://www.omnisport.tv/> [cid:image003.gif@01C98EBB.797B1DB0] <http://www.watchandbet.tv/>




________________________________________________________________________

CONFIDENTIALITY - This email and any files transmitted with it, are confidential, may be legally privileged and are intended solely for the use of the individual or entity to whom they are addressed. If this has come to you in error, you must not copy, distribute, disclose or use any of the information it contains. Please notify the sender immediately and delete them from your system.

SECURITY - Please be aware that communication by email, by its very nature, is not 100% secure and by communicating with Perform Group by email you consent to us monitoring and reading any such correspondence.

VIRUSES - Although this email message has been scanned for the presence of computer viruses, the sender accepts no liability for any damage sustained as a result of a computer virus and it is the recipient�s responsibility to ensure that email is virus free.

AUTHORITY - Any views or opinions expressed in this email are solely those of the sender and do not necessarily represent those of Perform Group.

COPYRIGHT - Copyright of this email and any attachments belongs to Perform Group, Companies House Registration number 6324278.

RE: How can you get OGNL to go faster?

Posted by Matthew Seaborn <Ma...@performgroup.com>.
Having looked into this it appears to be due to the fact that I was in DEV Mode; when running normally it is fine.

Why does DEV Mode affect the rendering speed?  Is it just the logging?

From: Matthew Seaborn
Sent: 14 February 2009 16:12
To: Struts Users Mailing List
Subject: How can you get OGNL to go faster?

I am currently running Struts 2.0.11 (planning to upgrade soon) with OGNL 2.6.11 and am having significant trouble with the appalling performance of OGNL.

The following XML using Struts 2 Tags and ORNL takes (using the s2 profiling) 2328ms to render

<%@ page contentType="text/xml" %><%--
--%><%@ taglib prefix="s" uri="/struts-tags" %><%--
--%><%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %><%--
--%><?xml version="1.0" ?>
<response>
      <entities>
            <s:iterator value="entities" id="entity">
                  <entity <%--
                  --%>id="<s:property value="id"/>" <%--
                  --%>name="<s:property value="name"/>" <%--
                  --%>externalId="<s:property value="externalId"/>" <%--
                  --%>color="<s:property value="renderColor"/>" <%--
                  --%>image="<s:property value="image.path"/>" <%--
                  --%>includeInKey="<s:property value="includeInKey"/>" <%--
                  --%>orderRank="<s:property value="orderRank"/>" <%--
                  --%> />
            </s:iterator>
      </entities>
</response>

The exact same functionality, using JSTL tags and EL, takes 15ms

<%@ page contentType="text/xml" %><%--
--%><%@ taglib prefix="s" uri="/struts-tags" %><%--
--%><%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %><%--
--%><?xml version="1.0" ?>
<response>
      <entities>
            <c:forEach items="${entities}" var="entity">
                  <entity <%--
                  --%>id="<c:out value="${entity.id}"/>" <%--
                  --%>name="<c:out value="${entity.name}"/>" <%--
                  --%>externalId="<c:out value="${entity.externalId}"/>" <%--
                  --%>color="<c:out value="${entity.renderColor}"/>" <%--
                  --%>image="<c:out value="${entity.image.path}"/>" <%--
                  --%>includeInKey="<c:out value="${entity.includeInKey}"/>" <%--
                  --%>orderRank="<c:out value="${entity.orderRank}"/>" <%--
                  --%> />
            </c:forEach>
      </entities>
</response>

In this case the S2/OGNL is 150x (!!!!!) slower than the standard approach.  Now clearly in this case I can simply use the JSTL/EL approach to get decent performance, but when using S2's Freemarker based tags I don't get that option.

Is this really as fast as OGNL can go, or there some optimisation/option I am missing?

Does anyone know how much faster is OGNL 2.7 supposed to be?

Matthew Seaborn
Software Architect
t    +44(0) 208 484 0729
m  +44(0) 7949 465 142
e   matthew.seaborn@performgroup.com<ma...@performgroup.com>


[cid:image001.jpg@01C98EBB.797B1DB0]<http://www.performgroup.com/>
Sussex House
Plane Tree Crescent
London, TW13 7HE
United Kingdom
www.performgroup.com<http://www.performgroup.com/>



 [cid:image002.gif@01C98EBB.797B1DB0] <http://www.omnisport.tv/> [cid:image003.gif@01C98EBB.797B1DB0] <http://www.watchandbet.tv/>




________________________________________________________________________

CONFIDENTIALITY - This email and any files transmitted with it, are confidential, may be legally privileged and are intended solely for the use of the individual or entity to whom they are addressed. If this has come to you in error, you must not copy, distribute, disclose or use any of the information it contains. Please notify the sender immediately and delete them from your system.

SECURITY - Please be aware that communication by email, by its very nature, is not 100% secure and by communicating with Perform Group by email you consent to us monitoring and reading any such correspondence.

VIRUSES - Although this email message has been scanned for the presence of computer viruses, the sender accepts no liability for any damage sustained as a result of a computer virus and it is the recipient?s responsibility to ensure that email is virus free.

AUTHORITY - Any views or opinions expressed in this email are solely those of the sender and do not necessarily represent those of Perform Group.

COPYRIGHT - Copyright of this email and any attachments belongs to Perform Group, Companies House Registration number 6324278.

________________________________________________________________________

CONFIDENTIALITY - This email and any files transmitted with it, are confidential, may be legally privileged and are intended solely for the use of the individual or entity to whom they are addressed. If this has come to you in error, you must not copy, distribute, disclose or use any of the information it contains. Please notify the sender immediately and delete them from your system.

SECURITY - Please be aware that communication by email, by its very nature, is not 100% secure and by communicating with Perform Group by email you consent to us monitoring and reading any such correspondence.

VIRUSES - Although this email message has been scanned for the presence of computer viruses, the sender accepts no liability for any damage sustained as a result of a computer virus and it is the recipient�s responsibility to ensure that email is virus free.

AUTHORITY - Any views or opinions expressed in this email are solely those of the sender and do not necessarily represent those of Perform Group.

COPYRIGHT - Copyright of this email and any attachments belongs to Perform Group, Companies House Registration number 6324278.