-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from nfl/hash_size
BACKEND-2482: Documented the default hash size (and broke it out into
- Loading branch information
Showing
10 changed files
with
42 additions
and
16 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
src/main/java/com/nfl/dm/shield/dynamic/config/HashConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.nfl.dm.shield.dynamic.config; | ||
|
||
/** | ||
* In order to get even distribution of hash codes (avoiding linear performance O(n)), it is best to initialize to | ||
* a prime number. As a hash table grows, one default algorithm increases size by 2n + 1. Sun developers initially | ||
* chose 101 as the default number. However, the growth characteristics of 101 are not as good as other selections. | ||
* | ||
* The book Java 2 Performance and Idiom Guide on page 73 offers the following as optimal initial bucket size: | ||
* 89, 179, 359, 719, 1439, 2879, 11519, 23029, 737279, 1474559, 2949119. | ||
* | ||
* We have chosen 89 as the starting place for all hash tables. | ||
*/ | ||
public final class HashConfig { | ||
public static final int DEFAULT_HASH_TABLE_SIZE = 89; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters