Description
I've noticed that your Java implementation of komihash
uses 4-byte values when hashing a string (hashCharsToLong). This looks like a slow approach. Why is that? You can hash using 8-byte values.
But anyway, please take a note that I've found and tested an "incremental" hashing approach with komihash
, it's described on the project page. You may consider switching your hash streamer to this incremental approach. It does not require pre-buffering and thus it's quite a lot more efficient for strings, and even small values like char, int, long. Also note that for register usage efficiency it's preferrable to save r1l
, r2l
, r3l
, r4l
multiplication results into corresponding Seed1..4
values, and then XOR them with Seed5-8
values.
To adopt the "incremental" hashing you'll need to implement a single "static" hashing function, without loading and storing the internal state. You'll just need to store a single "lastHash" value. It will likely be much more efficient than your current implementation.