Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-1229

Performance regression due to cyclic hashCode guard

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.5
    • 3.5
    • lang.builder.*
    • None

    Description

      We observed a severe performance regression in HashCodeBuilder in 3.5 trunk compared to 3.4 release. We get about 20% of the throughput in 3.5 trunk for common cases compared to 3.4 release. Previously there was no noticeable overhead of using HashCodeBuilder. Investigating we found the performance degradation was caused by the fix for LANG-456. It causes the method to be too large to be inlined and escape analysis to fail (see LANG-1218 for a related discussion).

      We currently do not see a way to keep the 3.4 performance and support cyclic graphs. The append methods have not supported cycles for so long we feel it's de facto part of the contract by now. Since neither the JDK nor the Guava hashCode helper methods support cyclic graphs we don't believe this is an unreasonable assumption. In addition EqualsBuilder#append(Object,Object) doesn't support cycles.

      If supporting cycles is a requirement we propose the introduction of new #appendRecursive (or named differently) methods to both HashCodeBuilder and EqualsBuilder that add cycle guards. If that is an acceptable compromise we would be willing to provide patches.

      Attachments

        Issue Links

          Activity

            People

              pascalschumacher Pascal Schumacher
              marschall Philippe Marschall
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: