diff options
-rw-r--r-- | NOTICES | 16 | ||||
-rw-r--r-- | searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/evaluation/StringValue.java | 8 | ||||
-rw-r--r-- | vespajlib/pom.xml | 5 |
3 files changed, 24 insertions, 5 deletions
@@ -366,3 +366,19 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +---------------------------------------------------------------------- +Zero-Allocation-Hashing (https://github.com/OpenHFT/Zero-Allocation-Hashing) + +Copyright 2015 Higher Frequency Trading http://www.higherfrequencytrading.com + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/evaluation/StringValue.java b/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/evaluation/StringValue.java index 6325d8d0334..c668292c0ab 100644 --- a/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/evaluation/StringValue.java +++ b/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/evaluation/StringValue.java @@ -5,9 +5,7 @@ import com.yahoo.javacc.UnicodeUtilities; import com.yahoo.searchlib.rankingexpression.rule.Function; import com.yahoo.tensor.Tensor; import com.yahoo.tensor.TensorType; -import net.jpountz.xxhash.XXHash64; -import net.jpountz.xxhash.XXHashFactory; - +import net.openhft.hashing.LongHashFunction; import java.nio.charset.StandardCharsets; /** @@ -41,9 +39,9 @@ public class StringValue extends Value { */ @Override public double asDouble() { - XXHash64 hasher = XXHashFactory.fastestInstance().hash64(); + // Hash using the xxh3 algorithm which is also used on content nodes byte[] data = value.getBytes(StandardCharsets.UTF_8); - long h = hasher.hash(data, 0, data.length, 0); + long h = LongHashFunction.xx3().hashBytes(data); if ((h & 0x7ff0000000000000L) == 0x7ff0000000000000L) { // Avoid nan h = h & 0xffefffffffffffffL; diff --git a/vespajlib/pom.xml b/vespajlib/pom.xml index 361e3a1f6ff..fd8c589ce14 100644 --- a/vespajlib/pom.xml +++ b/vespajlib/pom.xml @@ -41,6 +41,11 @@ <artifactId>commons-compress</artifactId> <scope>compile</scope> </dependency> + <dependency> + <groupId>net.openhft</groupId> + <artifactId>zero-allocation-hashing</artifactId> + <version>0.16</version> + </dependency> <!-- provided scope --> <dependency> |