This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new 02091e783a Fix BZ 68068 - El performance improvement
02091e783a is described below
commit 02091e783a967d16fea3e289d50a6881c0b3bb32
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 | 4 ++++
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/java/org/apache/el/parser/SimpleNode.java
b/java/org/apache/el/parser/SimpleNode.java
index a69851577f..cb8b2ad80d 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 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 implements Node {
@Override
public void jjtSetParent(Node n) {
- parent = n;
+ parent = (SimpleNode) n;
}
@Override
@@ -68,13 +74,13 @@ public abstract class SimpleNode 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 9bef493a58..113013ab92 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -205,6 +205,10 @@
<add>
Add support for Records to expression language. (markt)
</add>
+ <fix>
+ <bug>68068</bug>: Performance improvement for EL. Based on a suggestion
+ by John Engebretson. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="WebSocket">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]