mirror of
https://github.com/internetarchive/heritrix3.git
synced 2026-09-21 05:05:44 +00:00
* LongToIntConsistentHash.java
Skip unnecessary conversion from CharSequence to String
This commit is contained in:
@@ -76,10 +76,10 @@ public class LongToIntConsistentHash {
|
||||
return FPGenerator.std64.fp(bucketNumber+"."+replicaNumber);
|
||||
}
|
||||
|
||||
protected long hash(String string) {
|
||||
protected long hash(CharSequence cs) {
|
||||
// return ArchiveUtils.doubleMurmur(string.getBytes());
|
||||
// return (new JenkinsHash()).hash(string.getBytes());
|
||||
return FPGenerator.std64.fp(string);
|
||||
return FPGenerator.std64.fp(cs);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,7 +116,7 @@ public class LongToIntConsistentHash {
|
||||
* @return
|
||||
*/
|
||||
public int bucketFor(CharSequence cs, int upTo) {
|
||||
return bucketFor(hash(cs.toString()), upTo);
|
||||
return bucketFor(hash(cs), upTo);
|
||||
}
|
||||
|
||||
public int bucketFor(char[] chars, int upTo) {
|
||||
|
||||
Reference in New Issue
Block a user