All Projects → OpenHFT → Zero Allocation Hashing

OpenHFT / Zero Allocation Hashing

Zero-allocation hashing for Java

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Zero Allocation Hashing

Upash
🔒Unified API for password hashing algorithms
Stars: ✭ 484 (-13.73%)
Mutual labels:  hashing, hash-functions
prvhash
PRVHASH - Pseudo-Random-Value Hash. Hash functions, PRNG with unlimited period, randomness extractor. (Codename Gradilac/Градилак)
Stars: ✭ 194 (-65.42%)
Mutual labels:  hashing, hash-functions
Rhashmap
Robin Hood hash map library
Stars: ✭ 33 (-94.12%)
Mutual labels:  hashing, high-performance
T1ha
One of the fastest hash functions
Stars: ✭ 302 (-46.17%)
Mutual labels:  hashing, hash-functions
Scala Hashing
Fast non-cryptographic hash functions for Scala
Stars: ✭ 66 (-88.24%)
Mutual labels:  hashing, hash-functions
Crypto Hash
Tiny hashing module that uses the native crypto API in Node.js and the browser
Stars: ✭ 501 (-10.7%)
Mutual labels:  hashing, hash-functions
Sled
the champagne of beta embedded databases
Stars: ✭ 5,423 (+866.67%)
Mutual labels:  high-performance
Name That Hash
🔗 Don't know what type of hash it is? Name That Hash will name that hash type! 🤖 Identify MD5, SHA256 and 3000+ other hashes ☄ Comes with a neat web app 🔥
Stars: ✭ 540 (-3.74%)
Mutual labels:  hashing
Anakin
High performance Cross-platform Inference-engine, you could run Anakin on x86-cpu,arm, nv-gpu, amd-gpu,bitmain and cambricon devices.
Stars: ✭ 488 (-13.01%)
Mutual labels:  high-performance
C Sharp Algorithms
📚 📈 Plug-and-play class-library project of standard Data Structures and Algorithms in C#
Stars: ✭ 4,684 (+734.94%)
Mutual labels:  hashing
Librdkafka
The Apache Kafka C/C++ library
Stars: ✭ 5,617 (+901.25%)
Mutual labels:  high-performance
Fflate
High performance (de)compression in an 8kB package
Stars: ✭ 547 (-2.5%)
Mutual labels:  high-performance
Asyncpg
A fast PostgreSQL Database Client Library for Python/asyncio.
Stars: ✭ 5,216 (+829.77%)
Mutual labels:  high-performance
Xxl Rpc
A high performance, distributed RPC framework.(分布式服务框架XXL-RPC)
Stars: ✭ 493 (-12.12%)
Mutual labels:  high-performance
Lazy importer
library for importing functions from dlls in a hidden, reverse engineer unfriendly way
Stars: ✭ 544 (-3.03%)
Mutual labels:  hashing
Xxhash
Extremely fast non-cryptographic hash algorithm
Stars: ✭ 5,783 (+930.84%)
Mutual labels:  hash-functions
Symbolics.jl
A fast and modern CAS for a fast and modern language.
Stars: ✭ 435 (-22.46%)
Mutual labels:  high-performance
Edgedb
The next generation relational database.
Stars: ✭ 5,368 (+856.86%)
Mutual labels:  high-performance
Cdsa
A library of generic intrusive data structures and algorithms in ANSI C
Stars: ✭ 549 (-2.14%)
Mutual labels:  hash-functions
Orz
a high performance, general purpose data compressor written in rust
Stars: ✭ 509 (-9.27%)
Mutual labels:  high-performance

== Zero-Allocation Hashing

==== Version [#image-maven] [caption="", link=https://maven-badges.herokuapp.com/maven-central/net.openhft/zero-allocation-hashing] image::https://maven-badges.herokuapp.com/maven-central/net.openhft/zero-allocation-hashing/badge.svg[] [caption="", link=https://javadoc.io/doc/net.openhft/zero-allocation-hashing] image::https://javadoc.io/badge2/net.openhft/zero-allocation-hashing/javadoc.svg[]

=== Overview This project provides a Java API for hashing any sequence of bytes in Java, including all kinds of primitive arrays, buffers, CharSequences and more.

Written for Java 7+ under Apache 2.0 license.

The key difference compared to other similar projects, e.g. 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.

The implementation utilises native access where possible, but is also platform-endianness-agnostic. This provides consistent results whatever the byte order, while only moderately affecting performance.

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):

These are thoroughly tested with https://www.oracle.com/java/technologies/java-se-support-roadmap.html[LTS JDKs] 7, 8, and 11, the latest non-LTS JDKs 15 on both little- and big- endian platforms. Other non-LTS JDKs from 9 should also work, but they will not be tested from half year after EOL.

==== Performance

Tested on Intel Core i7-4870HQ CPU @ 2.50GHz |=== |Algorithm |Speed, GB/s |Bootstrap, ns

|xxHash |9.5 |6 |FarmHash na |9.0 |6 |FarmHash uo |7.2 |7 |CityHash |7.0 |7 |MurmurHash |5.3 |12 |MetroHash |https://github.com/OpenHFT/Zero-Allocation-Hashing/issues/28[??] | https://github.com/OpenHFT/Zero-Allocation-Hashing/issues/28[??] |WyHash |https://github.com/OpenHFT/Zero-Allocation-Hashing/issues/28[??] |https://github.com/OpenHFT/Zero-Allocation-Hashing/issues/28[??]

|===

To sum up,

==== When to use Zero-Allocation Hashing

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

==== When not to use Zero-Allocation Hashing

  • You need to hash POJOs whose actual data is scattered in memory between managed objects. There is no simple way to hash these using this project, for example, classes such as:

[source, Java]

class Person {
    String givenName, surName;
    int salary;
}

  • You need to hash byte sequences of unknown length, for the simpliest example, Iterator<Byte>.

  • 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.

==== Java Doc See http://javadoc.io/doc/net.openhft/zero-allocation-hashing/0.10.1

== Quick start

Gradle: [source, groovy]

dependencies { implementation 'net.openhft:zero-allocation-hashing:0.11' }

Or Maven: [source, xml]

net.openhft zero-allocation-hashing 0.11 ----

In Java: [source, Java]

long hash = LongHashFunction.wy_3().hashChars("hello");

See http://javadoc.io/doc/net.openhft/zero-allocation-hashing/0.11[JavaDocs] for more information.

== Contributions are most welcome!

See the list of https://github.com/OpenHFT/Zero-Allocation-Hashing/issues[open issues].

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].