[https://lemire.me/blog/2018/08/22/avoid-lexicographical-comparisons-when-testing-for-string-equality](https://lemire.me/blog/2018/08/22/avoid-lexicographical-comparisons-when-testing-for-string-equality)/

Output of running his code is
    
    
    $ ./memcmpfun
    mass_comparison(bigarray1, bigarray2,comparisonsA, N)               :  
8.296 cycles per operation (best)  2.411 bytes per cycle (best)      43.689 
cycles per operation (avg)
    mass_comparison_fast(bigarray1, bigarray2,comparisonsB, N)          :  
3.778 cycles per operation (best)  5.294 bytes per cycle (best)      4.356 
cycles per operation (avg)
    mass_comparison_faststruct(bigarray1, bigarray2,comparisonsB, N)    :  
4.667 cycles per operation (best)  4.286 bytes per cycle (best)      6.015 
cycles per operation (avg)
    mass_comparison_bcmp(bigarray1, bigarray2,comparisonsB, N)          :  
3.333 cycles per operation (best)  6.000 bytes per cycle (best)      3.793 
cycles per operation (avg)
    mass_comparison_hash(bigarray1, bigarray2,comparisonsB, N)          :  
8.000 cycles per operation (best)  2.500 bytes per cycle (best)      10.104 
cycles per operation (avg)
    
    
    Run

I have no idea how he gets the exact cycle count -- but its all contained in 
200 lines of code in file benchmark.h 

Reply via email to