Skip to content

Optimized the use of java.lang.Class#getInterfaces() in OgnlCompiler - #10

Merged
lukaszlenart merged 1 commit into
orphan-oss:masterfrom
danielfernandez:getinterfaces
May 17, 2015
Merged

lukaszlenart merged 1 commit into
orphan-oss:masterfrom
danielfernandez:getinterfaces

Conversation

@danielfernandez

Copy link
Copy Markdown
Contributor

Most of my profiling sessions show java.lang.Class#getInterfaces() as one of the hot spots under heavy OGNL load, because of being used at several methods in ognl.enhance.ExpressionCompiler, especially ognl.enhance.ExpressionCompiler#getInterfaceClass(java.lang.Class)

Indeed it seems this java.lang.Class#getInterfaces() method, even if being native, is quite slow for some strange reason. I've read a couple of complaints about it also related with Hibernate (see [1] and [2]).

Fortunately, I was able to importantly reduce the amount of times this method has to be called in ExpressionCompiler without losing any functionality, just re-structuring a bit the code. This should save a noticeable amount of execution time.

[1] https://forum.hibernate.org/viewtopic.php?p=2404651
[2] https://jira.atlassian.com/browse/CRUC-4518

@lukaszlenart

Copy link
Copy Markdown
Collaborator

Very neat!

lukaszlenart added a commit that referenced this pull request May 17, 2015
Optimized the use of java.lang.Class#getInterfaces() in OgnlCompiler
@lukaszlenart
lukaszlenart merged commit 4a8978e into orphan-oss:master May 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants