This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new eb41f61af5 Fix BZ 68068 - El performance improvement
eb41f61af5 is described below
commit eb41f61af56593d657b6e764c07f40dad4377e2a
Author: Mark Thomas <[email protected]>
AuthorDate: Tue Nov 7 16:50:08 2023 +0000
Fix BZ 68068 - El performance improvement
https://bz.apache.org/bugzilla/show_bug.cgi?id=68068
---
java/org/apache/el/parser/SimpleNode.java | 18 ++++++++++++------
webapps/docs/changelog.xml | 8 ++++++++
2 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/java/org/apache/el/parser/SimpleNode.java
b/java/org/apache/el/parser/SimpleNode.java
index 4b66cd7925..d222161525 100644
--- a/java/org/apache/el/parser/SimpleNode.java
+++ b/java/org/apache/el/parser/SimpleNode.java
@@ -33,9 +33,15 @@ import org.apache.el.util.MessageFactory;
* @author Jacob Hookom [[email protected]]
*/
public abstract class SimpleNode extends ELSupport implements Node {
- protected Node parent;
- protected Node[] children;
+ /*
+ * Uses SimpleNode rather than Node for performance.
+ *
+ * See https://bz.apache.org/bugzilla/show_bug.cgi?id=68068
+ */
+ protected SimpleNode parent;
+
+ protected SimpleNode[] children;
protected final int id;
@@ -57,7 +63,7 @@ public abstract class SimpleNode extends ELSupport implements
Node {
@Override
public void jjtSetParent(Node n) {
- parent = n;
+ parent = (SimpleNode) n;
}
@Override
@@ -68,13 +74,13 @@ public abstract class SimpleNode extends ELSupport
implements Node {
@Override
public void jjtAddChild(Node n, int i) {
if (children == null) {
- children = new Node[i + 1];
+ children = new SimpleNode[i + 1];
} else if (i >= children.length) {
- Node c[] = new Node[i + 1];
+ SimpleNode c[] = new SimpleNode[i + 1];
System.arraycopy(children, 0, c, 0, children.length);
children = c;
}
- children[i] = n;
+ children[i] = (SimpleNode) n;
}
@Override
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 9fb10cba4e..9762815b93 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -194,6 +194,14 @@
</fix>
</changelog>
</subsection>
+ <subsection name="Jasper">
+ <changelog>
+ <fix>
+ <bug>68068</bug>: Performance improvement for EL. Based on a suggestion
+ by John Engebretson. (markt)
+ </fix>
+ </changelog>
+ </subsection>
<subsection name="Web applications">
<changelog>
<fix>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]