Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-1071

Improve hash functions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.7.0
    • None
    • None

    Description

      There are hash functions in Utilities.hash and Util.hash and spread throughout the code, e.g. in ColumnMetaData and ClassDeclaration (search for uses of Object.hashCode).

      Suggested improvements:

      • Some multiply by 37; I'm not sure that all CPUs can multiply by 37 in one instruction; switch to a mersenne prime (2 ^ n - 1).
      • Util.hash uses shift and xor. Change that to multiply by a prime.
      • Lists should continue to multiply by 31 to be consistent with java.util.List.
      • Deprecate Util.hash methods and use Utilities.hash instead.

      Changing hash functions may cause some test output to change; be prepared for that.

      Attachments

        Activity

          People

            julianhyde Julian Hyde
            julianhyde Julian Hyde
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: