Is there a hash stress test for Delphi? something like SMHasher?

Is there a hash stress test for Delphi? something like SMHasher? 
I really don't feel like translating SMHasher into Delphi and I'm hoping someone has done something like this before.

I've got some hashes that run 30% faster than an optimized MurmurHash3, but need to validate collision behaviour.

Comments

  1. Arnaud's Crc32c is not plugin compatible because it has a different order of arguments.
    It would be really nice if Arnaud makes these routines plugin compatible with Emba's code.
    I wrote a wrapper.

    Here are the results.
    The reason why Meiyan is faster is that it only has one multiplication in its inner loop and the other manipulations happen in the latency time until the multiply is processing.

    MurmurHash3 does 2 multiplies in short succession, causing the CPU to idle whilst waiting for the result.

    Emba Bobjenkins uses a case statement to select the best routine for the input length given, but of course the branch prediction does not play nice with that.

    All the main loops are as tight as they are going to get, but there's optimization potential in the prolog and tail code.

    Starting testing
    Zipcodes 00000..99999
    BobJenkins Lookup3 took 126 ms, 270211 ticks
    BobJenkins Lookup3 has 34 max low collisions
    BobJenkins Lookup3 has 34 max high collisions
    BobJenkins Lookup3 has 1 real collisions
    Zipcodes 00000..99999
    MurmurHash3 took 76 ms, 163672 ticks
    MurmurHash3 has 34 max low collisions
    MurmurHash3 has 34 max high collisions
    MurmurHash3 has 1 real collisions
    Zipcodes 00000..99999
    CRC32cFast took 86 ms, 186317 ticks
    CRC32cFast has 23 max low collisions
    CRC32cFast has 24 max high collisions
    CRC32cFast has 0 real collisions
    Zipcodes 00000..99999
    FNV_1a_Meiyan took 64 ms, 139251 ticks
    FNV_1a_Meiyan has 32 max low collisions
    FNV_1a_Meiyan has 32 max high collisions
    FNV_1a_Meiyan has 0 real collisions
    integers
    BobJenkins Lookup3 took 71 ms, 153562 ticks
    BobJenkins Lookup3 has 35 max low collisions
    BobJenkins Lookup3 has 33 max high collisions
    BobJenkins Lookup3 has 1 real collisions
    integers
    MurmurHash3 took 28 ms, 61502 ticks
    MurmurHash3 has 34 max low collisions
    MurmurHash3 has 36 max high collisions
    MurmurHash3 has 0 real collisions
    integers
    CRC32cFast took 46 ms, 99062 ticks
    CRC32cFast has 16 max low collisions
    CRC32cFast has 16 max high collisions
    CRC32cFast has 0 real collisions
    integers
    FNV_1a_Meiyan took 24 ms, 52393 ticks
    FNV_1a_Meiyan has 47 max low collisions
    FNV_1a_Meiyan has 23 max high collisions
    FNV_1a_Meiyan has 0 real collisions
    Loading 120 MB password file...
    Done loading, starting the hash...
    120 MB of Passwords
    BobJenkins Lookup3 took 3686 ms, 7901380 ticks
    BobJenkins Lookup3 has 2593 max low collisions
    BobJenkins Lookup3 has 2595 max high collisions
    BobJenkins Lookup3 has 1 real collisions
    120 MB of Passwords
    MurmurHash3 took 2560 ms, 5487779 ticks
    MurmurHash3 has 2625 max low collisions
    MurmurHash3 has 2620 max high collisions
    MurmurHash3 has 1 real collisions
    120 MB of Passwords
    CRC32cFast took 2642 ms, 5663867 ticks
    CRC32cFast has 2634 max low collisions
    CRC32cFast has 2603 max high collisions
    CRC32cFast has 2 real collisions
    120 MB of Passwords
    FNV_1a_Meiyan took 2384 ms, 5109488 ticks
    FNV_1a_Meiyan has 2635 max low collisions
    FNV_1a_Meiyan has 2622 max high collisions
    FNV_1a_Meiyan has 1 real collisions
    120 MB of Passwords as fast as possible
    BobJenkins Lookup3 took 2848 ms, 6105489 ticks
    BobJenkins Lookup3 has 0 max low collisions
    BobJenkins Lookup3 has 0 max high collisions
    BobJenkins Lookup3 has 0 real collisions

    120 MB of Passwords as fast as possible
    I throw away the results here, so 0 collisions :-)
    MurmurHash3 took 1702 ms, 3649416 ticks
    MurmurHash3 has 0 max low collisions
    MurmurHash3 has 0 max high collisions
    MurmurHash3 has 0 real collisions

    120 MB of Passwords as fast as possible
    CRC32cFast took 1796 ms, 3850591 ticks

    ReplyDelete
  2. CRC32cFast has 0 max low collisions
    CRC32cFast has 0 max high collisions
    CRC32cFast has 0 real collisions

    120 MB of Passwords as fast as possible
    FNV_1a_Meiyan took 1557 ms, 3338430 ticks
    FNV_1a_Meiyan has 0 max low collisions
    FNV_1a_Meiyan has 0 max high collisions
    FNV_1a_Meiyan has 0 real collisions

    Done, press a key....

    ReplyDelete
  3. Johan Bontes Any modern CPU does a MUL opcode in one CPU cycle. See http://www.agner.org/optimize/instruction_tables.pdf

    ReplyDelete
  4. A. Bouchez Yes and in those same tables you'll see that IMUL has a llatency of 3 cycles. Meaning that it will  take a minimum of 3 cycles for the result to become available. If no instructions can be reordered to fill tthat space because they all depend on the outcome of that IMUL you will wait. 3 cycles or more. modern cpu can do 9 instructions in that time.

    ReplyDelete

Post a Comment