Daniel Sun created GROOVY-10216: ----------------------------------- Summary: Avoid unnecessary security checks for each invocation Key: GROOVY-10216 URL: https://issues.apache.org/jira/browse/GROOVY-10216 Project: Groovy Issue Type: Improvement Reporter: Daniel Sun Assignee: Daniel Sun Fix For: 4.0.0-beta-2
Java reflection will do security checks for each invocation, but if \{{setAccessible(true)}} called for the accessible objects, the unneccessary security checks could be avoided. See the result of "Performance Test": {code:java} FastMethodPerfTest.constructor_reflect_StringCtorCharArray avgt 15 18.471 ± 0.510 ns/op FastMethodPerfTest.constructor_reflect_accessible_StringCtorCharArray avgt 15 17.003 ± 0.528 ns/op FastMethodPerfTest.method_reflect_StringStartsWith avgt 15 12.264 ± 0.682 ns/op FastMethodPerfTest.method_reflect_accessible_StringStartsWith avgt 15 9.640 ± 0.732 ns/op {code} https://github.com/danielsun1106/fast-reflection -- This message was sent by Atlassian Jira (v8.3.4#803005)