Code Monkey home page Code Monkey logo

Comments (3)

benalexau avatar benalexau commented on June 8, 2024

On the speed issue, Hash-Bench tests over 100 hash implementations on the JVM and finds Zero-Allocation-Hashing's XXH64 is the fastest. Feel free to check the published results for yourself for the buffer sizes and types you wish to hash (ie direct ByteBuffer, on-heap ByteBuffer, plain byte[]) but SipHash is consistently slower. For example, a standard byte[32] with XXH64 hashes in 9 ns vs 52, 114, and 127 ns for the three Java SipHash implementations that Hash-Bench tests.

I don't see much reason to add extra hashers to Zero-Allocation-Hashing unless the algorithm has a material speed or functional advantage. To this end maybe Daniel Lemire's CLHash is worth exploration (see here which also includes a SipHash performance comparison).

from zero-allocation-hashing.

wkuranowski avatar wkuranowski commented on June 8, 2024

I agree that SipHash is slower than other simple hash functions. Speed is important but you need to look at other aspects. SipHash is a cryptographic hash function. It's really fast when you compare it to other cryptographic hash functions. Maybe we can gain even better performance with a new implementation.

SipHash is also immune to Hash DoS attacks, so it is used as default hash function in many languages: Perl, Python, Ruby, Haskell, Rust... etc.

In my opinion it's really nice to have a secure hash function, especially when one of the authors is DJB. I am not telling that everyone needs SipHash. But it has unique properties and is complementary to others.

from zero-allocation-hashing.

benalexau avatar benalexau commented on June 8, 2024

I agree XXH64 and SipHash aim at different problems. The Hash-Bench Scope section lists some other considerations too when comparing hash algos.

If SipHash is what you would like, the three implementations currently available in Java might be sufficient for you:

See Hash-Bench's 32 byte SipHash Report if you'd like graphs comparing their performance (summary: siphash-java-inline is more than twice as fast as the next fastest alternative).

from zero-allocation-hashing.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.