While profiling our application we identified the JSTL XML forEach tag as a serious performance issue. In looking at the implementation it appears that the 1.1 JSTL XPathUtil class seems to unnecessarily copy every variable from every context into an internal object to make the variables available to the XPath evaluation object. See 'fillVarStack' in 'selectNodes' method. The JSTL 1.0 version of XPathUtil doesn't do this at all - it takes a more reasonable approach of simply wrapping the original context objects in an object that implements the appropriate interface (VariableContext). I would suggest taking a similar approach to avoid the unnecessary overhead and garbage created by copying all of these objects on every executing of 'doStartTag'.
*** This bug has been marked as a duplicate of 27717 ***