Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-10216

Avoid unnecessary security checks for each invocation

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • None
    • None
    • None
    • None

    Description

      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":

      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
      

      https://github.com/danielsun1106/fast-reflection

      Attachments

        Activity

          People

            daniel_sun Daniel Sun
            daniel_sun Daniel Sun
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 20m
                20m