Skip to content

Commit 5a2cee4

Browse files
authored
Merge branch 'develop' into adv/formatting
2 parents dc54c03 + 02331d9 commit 5a2cee4

58 files changed

Lines changed: 947 additions & 487 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.adoc

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
== Zero-Allocation Hashing
2+
:pp: ++
23

34
Chronicle Software
45

@@ -15,7 +16,7 @@ toc::[]
1516

1617
This project provides a Java API for hashing any sequence of bytes in Java, including all kinds of primitive arrays, buffers, `CharSequence` and more.
1718

18-
Written for Java 7+ under Apache 2.0 license.
19+
Written for Java 8+ under Apache 2.0 licence.
1920

2021
The key difference compared to other similar projects, e.g.
2122
https://guava.dev/releases/28.1-jre/api/docs/com/google/common/hash/package-summary.html[Guava hashing], is that this has no object allocation during the hash computation and does not use `ThreadLocal`.
@@ -25,26 +26,26 @@ This provides consistent results whatever the byte order, while only moderately
2526

2627
Currently `long`-valued hash function interface is defined for 64-bit hash, and `long[]`-valued hash function interface for more than 64-bit hash, with the following implementations (in alphabetical order):
2728

28-
- *https://github.com/google/cityhash[CityHash], version 1.1* (latest; 1.1.1 is a C++ language-specific maintenance release).
29+
* *https://github.com/google/cityhash[CityHash], version 1.1* (latest; 1.1.1 is a C{pp} language-specific maintenance release).
2930

30-
- Two algorithms from *https://github.com/google/farmhash[FarmHash]*: `farmhashna` (introduced in FarmHash 1.0) and `farmhashuo` (introduced in FarmHash 1.1).
31+
* Two algorithms from *https://github.com/google/farmhash[FarmHash]*: `farmhashna` (introduced in FarmHash 1.0) and `farmhashuo` (introduced in FarmHash 1.1).
3132

32-
- *https://github.com/jandrewrogers/MetroHash[MetroHash]* (using the metrohash64_2 initialization vector).
33+
* *https://github.com/jandrewrogers/MetroHash[MetroHash]* (using the metrohash64_2 initialization vector).
3334

34-
- *https://github.com/aappleby/smhasher/wiki/MurmurHash3[MurmurHash3]* 128-bit and low 64-bit.
35+
* *https://github.com/aappleby/smhasher/wiki/MurmurHash3[MurmurHash3]* 128-bit and low 64-bit.
3536

36-
- *https://github.com/wangyi-fudan/wyhash[wyHash]*, version 3.
37+
* *https://github.com/wangyi-fudan/wyhash[wyHash]*, version 3.
3738

38-
- *https://github.com/Cyan4973/xxHash[xxHash]*.
39+
* *https://github.com/Cyan4973/xxHash[xxHash]*.
3940

40-
- *https://github.com/Cyan4973/xxHash[xxh3, xxh128]*, 128-bit and 64 bit.
41+
* *https://github.com/Cyan4973/xxHash[xxh3, xxh128]*, 128-bit and 64 bit.
4142

4243
These are thoroughly tested with
4344
*https://www.oracle.com/java/technologies/java-se-support-roadmap.html[LTS JDKs]*
44-
7, 8, and 11, the latest non-LTS JDKs 16 on both little- and big- endian platforms.
45-
Other non-LTS JDKs from 9 should also work, but they will not be tested from half year after EOL.
45+
8, 11, 17, and 21, plus the latest non-LTS JDKs on both little- and big-endian platforms.
46+
Other non-LTS JDKs from 9 should also work, but they will not be tested from half a year after EOL.
4647

47-
==== Performance
48+
=== Performance
4849

4950
Tested on Intel Core i7-4870HQ CPU @ 2.50GHz
5051

@@ -63,13 +64,13 @@ Tested on Intel Core i7-4870HQ CPU @ 2.50GHz
6364

6465
To sum up,
6566

66-
==== When to use Zero-Allocation Hashing
67+
=== When to use Zero-Allocation Hashing
6768

6869
* You need to hash plain byte sequences, memory blocks or "flat" objects.
6970
* You want zero-allocation and good performance (at Java scale).
7071
* You need hashing to be agile with regards to byte ordering.
7172

72-
==== When _not_ to use Zero-Allocation Hashing
73+
=== When _not_ to use Zero-Allocation Hashing
7374

7475
* You need to hash POJOs whose actual data is scattered in memory between managed objects.
7576
There is no simple way to hash these using this project, for example, classes such as:
@@ -82,23 +83,34 @@ There is no simple way to hash these using this project, for example, classes su
8283
}
8384
----
8485

85-
* You need to hash byte sequences of unknown length, for the simpliest example,
86+
* You need to hash byte sequences of unknown length, for the simplest example,
8687
`Iterator<Byte>`.
8788

8889
* You need to transform the byte sequence (e.g. encode or decode it with a specific coding), and hash the resulting byte sequence on the way without dumping it to memory.
8990

90-
==== Java Doc
91+
=== Javadoc
9192

9293
See http://javadoc.io/doc/net.openhft/zero-allocation-hashing/latest
9394

95+
=== Internal documentation
96+
97+
* link:src/main/docs/specifications.adoc[Requirements overview]
98+
* link:src/main/docs/architecture-overview.adoc[Architecture overview]
99+
* link:src/main/docs/invariants-and-contracts.adoc[Invariants and contracts]
100+
* link:src/main/docs/algorithm-profiles.adoc[Algorithm profiles]
101+
* link:src/main/docs/testing-strategy.adoc[Testing strategy]
102+
* link:src/main/docs/performance-benchmarks.adoc[Performance benchmarks]
103+
* link:src/main/docs/unsafe-and-platform-notes.adoc[Unsafe and platform notes]
104+
* link:src/main/docs/change-log-template.adoc[Change-log template]
105+
94106
== Quick start
95107

96108
Gradle:
97109

98110
[source,groovy]
99111
----
100112
dependencies {
101-
implementation 'net.openhft:zero-allocation-hashing:0.16'
113+
implementation 'net.openhft:zero-allocation-hashing:0.27ea1'
102114
}
103115
----
104116

@@ -109,7 +121,7 @@ Or Maven:
109121
<dependency>
110122
<groupId>net.openhft</groupId>
111123
<artifactId>zero-allocation-hashing</artifactId>
112-
<version>0.16</version>
124+
<version>0.27ea1</version>
113125
</dependency>
114126
----
115127

@@ -120,7 +132,7 @@ In Java:
120132
long hash = LongHashFunction.wy_3().hashChars("hello");
121133
----
122134

123-
See *http://javadoc.io/doc/net.openhft/zero-allocation-hashing/0.15[JavaDocs]* for more information.
135+
See *http://javadoc.io/doc/net.openhft/zero-allocation-hashing/latest[JavaDocs]* for more information.
124136

125137
== Contributions are most welcome!
126138

pom.xml

Lines changed: 32 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,23 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
3-
~ Copyright 2014 Higher Frequency Trading http://www.higherfrequencytrading.com
4-
~
5-
~ Licensed under the Apache License, Version 2.0 (the "License");
6-
~ you may not use this file except in compliance with the License.
7-
~ You may obtain a copy of the License at
8-
~
9-
~ http://www.apache.org/licenses/LICENSE-2.0
10-
~
11-
~ Unless required by applicable law or agreed to in writing, software
12-
~ distributed under the License is distributed on an "AS IS" BASIS,
13-
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
~ See the License for the specific language governing permissions and
15-
~ limitations under the License.
16-
-->
3+
4+
Copyright 2013-2025 chronicle.software; SPDX-License-Identifier: Apache-2.0
5+
6+
-->
177

188
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
199
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2010

2111
<parent>
2212
<groupId>net.openhft</groupId>
2313
<artifactId>java-parent-pom</artifactId>
24-
<version>1.27ea1</version>
25-
<relativePath/>
14+
<version>2026.0</version>
15+
<relativePath />
2616
</parent>
2717

2818
<modelVersion>4.0.0</modelVersion>
2919
<artifactId>zero-allocation-hashing</artifactId>
30-
<version>0.27ea2-SNAPSHOT</version>
20+
<version>2026.1-SNAPSHOT</version>
3121
<name>Zero-allocation Hashing</name>
3222
<description>Zero-allocation implementations of fast non-cryptographic hash functions
3323
for byte sequences or blocks of memory
@@ -50,6 +40,7 @@
5040
<maven.bundle.plugin.version>5.1.1</maven.bundle.plugin.version>
5141

5242
<doclint>all,-missing</doclint>
43+
<jmh.version>1.37</jmh.version>
5344
<sonar.organization>openhft</sonar.organization>
5445
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
5546
</properties>
@@ -76,7 +67,7 @@
7667
<dependency>
7768
<groupId>junit</groupId>
7869
<artifactId>junit</artifactId>
79-
<version>4.13.1</version>
70+
<version>4.13.2</version>
8071
<scope>test</scope>
8172
<!-- JUnit 4 supports Java 7, but JUnit 5 don't. -->
8273
</dependency>
@@ -88,22 +79,36 @@
8879
<scope>test</scope>
8980
</dependency>
9081

82+
<dependency>
83+
<groupId>org.openjdk.jmh</groupId>
84+
<artifactId>jmh-core</artifactId>
85+
<version>${jmh.version}</version>
86+
<scope>test</scope>
87+
</dependency>
88+
89+
<dependency>
90+
<groupId>org.openjdk.jmh</groupId>
91+
<artifactId>jmh-generator-annprocess</artifactId>
92+
<version>${jmh.version}</version>
93+
<scope>test</scope>
94+
</dependency>
95+
9196
</dependencies>
9297

9398
<build>
9499
<pluginManagement>
95100
<plugins>
96101
<plugin>
97102
<artifactId>maven-clean-plugin</artifactId>
98-
<version>3.1.0</version>
103+
<version>3.5.0</version>
99104
</plugin>
100105
<plugin>
101106
<artifactId>maven-install-plugin</artifactId>
102-
<version>3.0.0-M1</version>
107+
<version>3.1.4</version>
103108
</plugin>
104109
<plugin>
105110
<artifactId>maven-site-plugin</artifactId>
106-
<version>3.9.0</version>
111+
<version>3.12.1</version>
107112
</plugin>
108113
</plugins>
109114
</pluginManagement>
@@ -138,7 +143,6 @@
138143

139144
<plugin>
140145
<artifactId>maven-compiler-plugin</artifactId>
141-
<version>3.8.1</version>
142146
<configuration>
143147
<compilerArgs>
144148
<!-- used for disable warning for target release 9+ -->
@@ -208,20 +212,11 @@
208212

209213
<plugin>
210214
<artifactId>maven-source-plugin</artifactId>
211-
<version>3.2.1</version>
212-
<executions>
213-
<execution>
214-
<id>attach-sources</id>
215-
<goals>
216-
<goal>jar-no-fork</goal>
217-
</goals>
218-
<configuration>
219-
<excludes>
220-
<exclude>sun/**</exclude>
221-
</excludes>
222-
</configuration>
223-
</execution>
224-
</executions>
215+
<configuration>
216+
<excludes>
217+
<exclude>sun/**</exclude>
218+
</excludes>
219+
</configuration>
225220
</plugin>
226221

227222
<plugin>
@@ -270,7 +265,6 @@
270265
<plugin>
271266
<groupId>org.apache.felix</groupId>
272267
<artifactId>maven-bundle-plugin</artifactId>
273-
<version>${maven.bundle.plugin.version}</version>
274268
<extensions>true</extensions>
275269
<configuration>
276270
<instructions>
@@ -299,7 +293,6 @@
299293
</execution>
300294
</executions>
301295
</plugin>
302-
303296
</plugins>
304297
</build>
305298

@@ -351,7 +344,7 @@
351344
<goal>test</goal>
352345
</goals>
353346
<configuration>
354-
<argLine>-XX:-CompactStrings</argLine>
347+
<argLine>@{argLine} -XX:-CompactStrings ${jvm.requiredArgs}</argLine>
355348
</configuration>
356349
</execution>
357350
</executions>
@@ -392,37 +385,5 @@
392385
</plugins>
393386
</build>
394387
</profile>
395-
<profile>
396-
<id>sonar</id>
397-
<build>
398-
<plugins>
399-
<plugin>
400-
<groupId>org.sonarsource.scanner.maven</groupId>
401-
<artifactId>sonar-maven-plugin</artifactId>
402-
<version>3.8.0.2131</version>
403-
</plugin>
404-
<plugin>
405-
<groupId>org.jacoco</groupId>
406-
<artifactId>jacoco-maven-plugin</artifactId>
407-
<version>0.8.6</version>
408-
<executions>
409-
<execution>
410-
<goals>
411-
<goal>prepare-agent</goal>
412-
</goals>
413-
</execution>
414-
<execution>
415-
<id>report</id>
416-
<phase>prepare-package</phase>
417-
<goals>
418-
<goal>report</goal>
419-
</goals>
420-
</execution>
421-
</executions>
422-
</plugin>
423-
</plugins>
424-
</build>
425-
</profile>
426-
427388
</profiles>
428389
</project>

0 commit comments

Comments
 (0)