You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.adoc
+30-18Lines changed: 30 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,5 @@
1
1
== Zero-Allocation Hashing
2
+
:pp: ++
2
3
3
4
Chronicle Software
4
5
@@ -15,7 +16,7 @@ toc::[]
15
16
16
17
This project provides a Java API for hashing any sequence of bytes in Java, including all kinds of primitive arrays, buffers, `CharSequence` and more.
17
18
18
-
Written for Java 7+ under Apache 2.0 license.
19
+
Written for Java 8+ under Apache 2.0 licence.
19
20
20
21
The key difference compared to other similar projects, e.g.
21
22
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
25
26
26
27
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):
27
28
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).
29
30
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).
31
32
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).
33
34
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.
35
36
36
-
- *https://github.com/wangyi-fudan/wyhash[wyHash]*, version 3.
37
+
* *https://github.com/wangyi-fudan/wyhash[wyHash]*, version 3.
37
38
38
-
- *https://github.com/Cyan4973/xxHash[xxHash]*.
39
+
* *https://github.com/Cyan4973/xxHash[xxHash]*.
39
40
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.
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.
46
47
47
-
==== Performance
48
+
=== Performance
48
49
49
50
Tested on Intel Core i7-4870HQ CPU @ 2.50GHz
50
51
@@ -63,13 +64,13 @@ Tested on Intel Core i7-4870HQ CPU @ 2.50GHz
63
64
64
65
To sum up,
65
66
66
-
==== When to use Zero-Allocation Hashing
67
+
=== When to use Zero-Allocation Hashing
67
68
68
69
* You need to hash plain byte sequences, memory blocks or "flat" objects.
69
70
* You want zero-allocation and good performance (at Java scale).
70
71
* You need hashing to be agile with regards to byte ordering.
71
72
72
-
==== When _not_ to use Zero-Allocation Hashing
73
+
=== When _not_ to use Zero-Allocation Hashing
73
74
74
75
* You need to hash POJOs whose actual data is scattered in memory between managed objects.
75
76
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
82
83
}
83
84
----
84
85
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,
86
87
`Iterator<Byte>`.
87
88
88
89
* 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.
89
90
90
-
==== Java Doc
91
+
=== Javadoc
91
92
92
93
See http://javadoc.io/doc/net.openhft/zero-allocation-hashing/latest
0 commit comments