0

Slowness due to ClassLoader.getResourceAsStream() in ExpressionFactory

asked 2014-09-02 12:25:23 +0800

adamian gravatar image adamian
15 4

Hello everyone,

We've had some slowness (ZK 6.0.2.1 but source code for the file looks the same in 7) in using the grid (for example with 48 rows and 50-100 columns). I've used the NetBeans's profiler and found that the functions getClassNameServices and getClassNameJreDir took too much.

ZK (ZEL) uses http://www.zkoss.org/javadoc/7.0.3/zk/org/zkoss/zel/ExpressionFactory.html#newInstance() to get an instance of this class.

Create a new ExpressionFactory. The class to use is determined by the following search order:

  1. services API (META-INF/services/org.zkoss.zel.ExpressionFactory)
  2. $JRE_HOME/lib/el.properties - key org.zkoss.zel.ExpressionFactory
  3. org.zkoss.zel.ExpressionFactory
  4. Platform default implementation - org.zkoss.zel.impl.ExpressionFactoryImpl

The calls to ClassLoader.getSystemResourceAsStream() from getClassNameServices() and to newFile().canRead() from getClassNameJreDir() look expensive and the results are not being cached.

By not calling these two functions the time dropped visibly. In one case for example from 1.13 seconds to 333 ms.

Let me know if you need more information or if I should open an issue in the bug tracker.
Profiler screenshot: http://postimg.org/image/djaz4y0v5/

Best regards,
Andrei

Edit the post/tags as appropriate.

delete flag offensive retag edit
Be the first one to reply this discussion!
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2014-09-02 12:25:23 +0800

Seen: 3 times

Last updated: Sep 02 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More