This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.1.x by this push:
     new 3a509e6687 Fix BZ 68546 - minor optimization
3a509e6687 is described below

commit 3a509e66877cfe3507a83d7be9a5b2fa5828b43f
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Jun 3 15:16:24 2024 +0100

    Fix BZ 68546 - minor optimization
    
    Based on a patch by Dan Armstrong
---
 java/org/apache/jasper/compiler/Generator.java | 5 +++--
 webapps/docs/changelog.xml                     | 9 +++++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/jasper/compiler/Generator.java 
b/java/org/apache/jasper/compiler/Generator.java
index b305431ce7..addaff3f6b 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -625,7 +625,8 @@ class Generator {
         // Packages is never empty because o.a.j.Constants.STANDARD_IMPORTS
         // contains 3 packages and is always added to the imports.
         out.printin("_jspx_imports_packages = new java.util.LinkedHashSet<>(");
-        out.print(Integer.toString(packages.size()));
+        // Allow for the default load factor of 0.75
+        out.print(Integer.toString((int) Math.ceil(packages.size() / 0.75)));
         out.print(");");
         out.println();
         for (String packageName : packages) {
@@ -639,7 +640,7 @@ class Generator {
             out.println();
         } else {
             out.printin("_jspx_imports_classes = new 
java.util.LinkedHashSet<>(");
-            out.print(Integer.toString(classes.size()));
+            out.print(Integer.toString((int) Math.ceil(classes.size() / 
0.75)));
             out.print(");");
             out.println();
             for (String className : classes) {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index bceee651b2..390870161c 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -136,6 +136,15 @@
       </fix>
     </changelog>
   </subsection>
+  <subsection name="Jasper">
+    <changelog>
+      <fix>
+        <bug>68546</bug>: Small additional optimisation for initial loading of
+        Servlet code generated for JSPs. Based on a suggestion by Dan 
Armstrong.
+        (markt)
+      </fix>
+    </changelog>
+  </subsection>
   <subsection name="Other">
     <changelog>
       <update>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to