Uploaded image for project: 'Hibernate Validator'
  1. HV-1566

Cache type variable index for performance reasons

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.0.8.Final
    • Component/s: engine
    • Labels:

      Description

      While doing some profiling on cascaded and collection validation a `TypeVariables#getTypeParameterIndex()` showed pretty high and it looks that we can omit calculating it at runtime. After the changes here are some benchmark results:

      current master:
      
      # Run complete. Total time: 00:01:52
      
      Benchmark                                                                                   Mode  Cnt    Score    Error   Units
      CascadedValidation.testCascadedValidation                                                  thrpt   20  160.152 ± 11.923  ops/ms
      CascadedWithLotsOfItemsAndMoreConstraintsValidation.testCascadedValidationWithLotsOfItems  thrpt   20  471.770 ±  8.797   ops/s
      CascadedWithLotsOfItemsValidation.testCascadedValidationWithLotsOfItems                    thrpt   20  633.382 ± 11.182   ops/s
      
      with changes
      
      # Run complete. Total time: 00:01:50
      
      Benchmark                                                                                   Mode  Cnt    Score    Error   Units
      CascadedValidation.testCascadedValidation                                                  thrpt   20  170.439 ± 15.699  ops/ms
      CascadedWithLotsOfItemsAndMoreConstraintsValidation.testCascadedValidationWithLotsOfItems  thrpt   20  471.262 ± 20.874   ops/s
      CascadedWithLotsOfItemsValidation.testCascadedValidationWithLotsOfItems                    thrpt   20  703.661 ± 39.131   ops/s
      

        Attachments

          Activity

            People

            • Assignee:
              markob Marko Bekhta
              Reporter:
              markob Marko Bekhta
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: