Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-4200

Improve ZEL ImportHandler performance

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Done
    • Icon: Major Major
    • 8.6.1
    • 8.6.0.1
    • ZK Interpreter
    • Security Level: Jimmy
    • ZK 8.6.1 S1

      Steps to Reproduce

      repeated calls to resove EL variable suffer from a performance hit due to uncached unresolvable classes

      	<div>
      		<custom-attributes myvar="123"/>
      		<div forEach="1,2,3">
      			${myvar}
      		</div>
      	</div>
      

      The code above leads to 3 caught ClassNotFoundExceptions in org.zkoss.zel.ImportHandler#findClass(String name)
      https://github.com/zkoss/zk/blob/v8.6.0.1/zel/src/org/zkoss/zel/ImportHandler.java#L203-L207

      The attached test scenario TestImportHandlerPerformance.java highlighting the difference between a cache hit and a cache miss at larger volumes.
      At 100000 repetitions, resolving java.lang.Object takes ~<1ms, while repeated failing to resolve a variable 'test' results in significant slowdown (~600ms)

      Possible Solution

      This has been avoided in tomcat's EL implementation since 8.0.21

      https://tomcat.apache.org/tomcat-8.0-doc/changelog.html#Tomcat_8.0.21_(markt)/Jasper

      https://svn.apache.org/viewvc/tomcat/archive/tc8.0.x/tags/TOMCAT_8_0_21/java/javax/el/ImportHandler.java?revision=1848138&view=markup#l174

      https://bz.apache.org/bugzilla/show_bug.cgi?id=57583

      We should further evaluate if a later tomcat version (8.5 or 9 - all use EL 3.0 ) contains additional beneficial fixes and improvements to merge in to ZK's EL adaptation.

            rudyhuang rudyhuang
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 4 hours
                4h
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 hours
                4h