Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.0.11
    • Fix Version/s: 2.3.1
    • Component/s: Expression Language
    • Labels:
      None
    • Environment:

      Windows XP 5.1 (2Gb, dual-core 1.8GHz), Java 1.5.0_08, Tomcat 5.5

    • Flags:
      Important

      Description

      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 the JSTL/EL approach can be used to get decent performance, but when using S2's Freemarker based tags that option isn't available.

        Activity

        Matthew created issue -
        Matthew Seaborn made changes -
        Field Original Value New Value
        Description 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?
        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 the JSTL/EL approach can be used to get decent performance, but when using S2's Freemarker based tags that option isn't available.

        Jeff Turner made changes -
        Project Import Mon Feb 01 01:17:42 UTC 2010 [ 1264987062082 ]
        Lukasz Lenart made changes -
        Fix Version/s 2.3.x [ 12319176 ]
        Lukasz Lenart made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Lukasz Lenart [ lukaszlenart ]
        Fix Version/s 2.3.1 [ 12315916 ]
        Fix Version/s 2.3.x [ 12319176 ]
        Resolution Won't Fix [ 2 ]
        Lukasz Lenart made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Lukasz Lenart
            Reporter:
            Matthew
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development