Serious OGNL Performance Issues
-------------------------------

                 Key: WW-2998
                 URL: https://issues.apache.org/struts/browse/WW-2998
             Project: Struts 2
          Issue Type: Improvement
          Components: Expression Language
    Affects Versions: 2.0.11
         Environment: Windows XP 5.1 (2Gb, dual-core 1.8GHz), Java 1.5.0_08,  
Tomcat 5.5
            Reporter: Matthew Seaborn


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 OGNL 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 JSTL/EL 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?  


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to