Skip Menu |

This queue is for tickets about the Benchmark-Perl-CoreHashes CPAN distribution.

Report information
The Basics
Id: 99370
Status: new
Priority: 0/
Queue: Benchmark-Perl-CoreHashes

People
Owner: Nobody in particular
Requestors: KENTNL [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.02
Fixed in: (no value)



Subject: Feature Request: Include newer MURMUR_HASH_64A/B

There are 2 newer hash functions in blead which would be interesting to see raw performance of:

hv_func.h:        || defined(PERL_HASH_FUNC_MURMUR_HASH_64A) \
hv_func.h:        || defined(PERL_HASH_FUNC_MURMUR_HASH_64B) \

Though to include these in output, some platform detection/fail safes might have to be added.

Managed to patch it myself into working.

 

# time for PERL_HASH_FUNC_SIPHASH is 12.3072559833527
# time for PERL_HASH_FUNC_SDBM is 1.7642650604248
# time for PERL_HASH_FUNC_DJB2 is 2.15215301513672
# time for PERL_HASH_FUNC_SUPERFAST is 3.48679804801941
# time for PERL_HASH_FUNC_MURMUR3 is 5.11463499069214
# time for PERL_HASH_FUNC_ONE_AT_A_TIME is 4.16085195541382
# time for PERL_HASH_FUNC_ONE_AT_A_TIME_HARD is 7.88369512557983
# time for PERL_HASH_FUNC_ONE_AT_A_TIME_OLD is 3.99120020866394
# time for PERL_HASH_FUNC_MURMUR_HASH_64A is 3.86607193946838
# time for PERL_HASH_FUNC_MURMUR_HASH_64B is 2.71661996841431
 

Patch attached.

Subject: murmur-hashes.patch
diff -Naur Benchmark-Perl-CoreHashes-0.02/CoreHashes.xs Benchmark-Perl-CoreHashes-0.02-b/CoreHashes.xs --- Benchmark-Perl-CoreHashes-0.02/CoreHashes.xs 2013-10-12 01:00:55.000000000 +0000 +++ Benchmark-Perl-CoreHashes-0.02-b/CoreHashes.xs 2016-05-28 08:16:46.900858548 +0000 @@ -3,6 +3,8 @@ //below causes memory overrun on most perls, IDC #define PERL_HASH_SEED_BYTES 16 #include "EXTERN.h" +#define PERL_HASH_FUNC_MURMUR_HASH_64A +#define PERL_HASH_FUNC_MURMUR_HASH_64B #include "perl.h" #include "XSUB.h" @@ -41,6 +43,8 @@ #undef PERL_HASH_FUNC_ONE_AT_A_TIME #undef PERL_HASH_FUNC_ONE_AT_A_TIME_HARD #undef PERL_HASH_FUNC_ONE_AT_A_TIME_OLD +#undef PERL_HASH_FUNC_MURMUR_HASH_64A +#undef PERL_HASH_FUNC_MURMUR_HASH_64B #undef PERL_HASH_SEED #define PERL_HASH_SEED "PeRlHaShhAcKpErl" @@ -223,6 +227,52 @@ RETVAL = 0; for(i=0; i < 1000000; i++){ for(iarr=0; iarr < sizeof(arrlen); iarr++){ + U32 hash; + PERL_HASH(hash, arr[iarr], arrlen[iarr]); + RETVAL += hash; + } + } +OUTPUT: + RETVAL + +U32 +run_PERL_HASH_FUNC_MURMUR_HASH_64A() +PREINIT: + int i; + int iarr; +CODE: +#undef PERL_HASH_FUNC +#undef PERL_HASH_SEED_BYTES +#undef PERL_HASH +#define PERL_HASH_FUNC "MURMUR_HASH_64A" +#define PERL_HASH_SEED_BYTES 8 +#define PERL_HASH(hash,str,len) (hash)= S_perl_hash_murmur_hash_64a(PERL_HASH_SEED,(U8*)(str),(len)) + RETVAL = 0; + for(i=0; i < 1000000; i++){ + for(iarr=0; iarr < sizeof(arrlen); iarr++){ + U32 hash; + PERL_HASH(hash, arr[iarr], arrlen[iarr]); + RETVAL += hash; + } + } +OUTPUT: + RETVAL + +U32 +run_PERL_HASH_FUNC_MURMUR_HASH_64B() +PREINIT: + int i; + int iarr; +CODE: +#undef PERL_HASH_FUNC +#undef PERL_HASH_SEED_BYTES +#undef PERL_HASH +#define PERL_HASH_FUNC "MURMUR_HASH_64B" +#define PERL_HASH_SEED_BYTES 8 +#define PERL_HASH(hash,str,len) (hash)= S_perl_hash_murmur_hash_64b(PERL_HASH_SEED,(U8*)(str),(len)) + RETVAL = 0; + for(i=0; i < 1000000; i++){ + for(iarr=0; iarr < sizeof(arrlen); iarr++){ U32 hash; PERL_HASH(hash, arr[iarr], arrlen[iarr]); RETVAL += hash; diff -Naur Benchmark-Perl-CoreHashes-0.02/lib/Benchmark/Perl/CoreHashes.pm Benchmark-Perl-CoreHashes-0.02-b/lib/Benchmark/Perl/CoreHashes.pm --- Benchmark-Perl-CoreHashes-0.02/lib/Benchmark/Perl/CoreHashes.pm 2013-10-12 01:47:52.000000000 +0000 +++ Benchmark-Perl-CoreHashes-0.02-b/lib/Benchmark/Perl/CoreHashes.pm 2016-05-28 08:06:54.629149874 +0000 @@ -20,6 +20,8 @@ run_PERL_HASH_FUNC_ONE_AT_A_TIME run_PERL_HASH_FUNC_ONE_AT_A_TIME_HARD run_PERL_HASH_FUNC_ONE_AT_A_TIME_OLD + run_PERL_HASH_FUNC_MURMUR_HASH_64A + run_PERL_HASH_FUNC_MURMUR_HASH_64B ); our $VERSION = '0.02'; diff -Naur Benchmark-Perl-CoreHashes-0.02/t/Benchmark-Perl-CoreHashes.t Benchmark-Perl-CoreHashes-0.02-b/t/Benchmark-Perl-CoreHashes.t --- Benchmark-Perl-CoreHashes-0.02/t/Benchmark-Perl-CoreHashes.t 2013-10-11 04:52:51.000000000 +0000 +++ Benchmark-Perl-CoreHashes-0.02-b/t/Benchmark-Perl-CoreHashes.t 2016-05-28 08:04:12.979799676 +0000 @@ -18,6 +18,8 @@ PERL_HASH_FUNC_ONE_AT_A_TIME PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_HASH_FUNC_ONE_AT_A_TIME_OLD + PERL_HASH_FUNC_MURMUR_HASH_64A + PERL_HASH_FUNC_MURMUR_HASH_64B |; #disabled to make results easier to read for now #@subnames = shuffle @subnames;
Subject: Feature Request: Include newer SIPHASH13 and _HYBRID_OAATHU_SIPHASH13


Updating request because as of 6b0260474df579e9412f57249519747ab8bb5c2b these hashes exist, and as of 236a70292a4ef354958701000e8897894141eb26 , all the following hashes are gone!

-        || defined(PERL_HASH_FUNC_SDBM) \
-        || defined(PERL_HASH_FUNC_DJB2) \
-        || defined(PERL_HASH_FUNC_SUPERFAST) \
-        || defined(PERL_HASH_FUNC_MURMUR3) \
-        || defined(PERL_HASH_FUNC_ONE_AT_A_TIME) \
-        || defined(PERL_HASH_FUNC_ONE_AT_A_TIME_OLD) \
-        || defined(PERL_HASH_FUNC_MURMUR_HASH_64A) \
-        || defined(PERL_HASH_FUNC_MURMUR_HASH_64B) \
 

Yay!



-- 
- CPAN kentnl@cpan.org
- Gentoo Perl Maintainer kentnl@gentoo.org ( perl@gentoo.org )
 

Attached are updated patches that together will restore 5.25.11+ compatibility ( at the sacrifice of being incompatible with older perls due to new + removed hash functions -_- )

-- 
- CPAN kentnl@cpan.org
- Gentoo Perl Maintainer kentnl@gentoo.org ( perl@gentoo.org )
Subject: 0001-Remove-hashes-symbols-removed-in-5.25.8.patch
From 65c3a3b89296fc49ee9e417bec06b9693fd32e7d Mon Sep 17 00:00:00 2001 From: Kent Fredric <kentfredric@gmail.com> Date: Fri, 17 Mar 2017 22:47:25 +1300 Subject: Remove hashes symbols removed in 5.25.8 6b0260474df579e9412f57249519747ab8bb5c2b removed: - SDBM - DJB2 - SUPERFAST - MURMUR3 - ONE_AT_A_TIME - ONE_AT_A_TIME_OLD - MURMUR_HASH_64A - MURMUR_HASH_64B --- CoreHashes.xs | 143 --------------------------------------- lib/Benchmark/Perl/CoreHashes.pm | 6 -- t/Benchmark-Perl-CoreHashes.t | 6 -- 3 files changed, 155 deletions(-) diff --git a/CoreHashes.xs b/CoreHashes.xs index 9306c16..9f3acc1 100755 --- a/CoreHashes.xs +++ b/CoreHashes.xs @@ -34,13 +34,7 @@ static const char arrlen [] = { #undef XMM #undef PERL_HASH_FUNC_SIPHASH -#undef PERL_HASH_FUNC_SDBM -#undef PERL_HASH_FUNC_DJB2 -#undef PERL_HASH_FUNC_SUPERFAST -#undef PERL_HASH_FUNC_MURMUR3 -#undef PERL_HASH_FUNC_ONE_AT_A_TIME #undef PERL_HASH_FUNC_ONE_AT_A_TIME_HARD -#undef PERL_HASH_FUNC_ONE_AT_A_TIME_OLD #undef PERL_HASH_SEED #define PERL_HASH_SEED "PeRlHaShhAcKpErl" @@ -70,120 +64,6 @@ CODE: OUTPUT: RETVAL -U32 -run_PERL_HASH_FUNC_SDBM() -PREINIT: - int i; - int iarr; -CODE: -#undef PERL_HASH_FUNC -#undef PERL_HASH_SEED_BYTES -#undef PERL_HASH -#define PERL_HASH_FUNC "SDBM" -#define PERL_HASH_SEED_BYTES 4 -#define PERL_HASH(hash,str,len) (hash)= S_perl_hash_sdbm(PERL_HASH_SEED,(U8*)(str),(len)) - RETVAL = 0; - for(i=0; i < 1000000; i++){ - for(iarr=0; iarr < sizeof(arrlen); iarr++){ - U32 hash; - PERL_HASH(hash, arr[iarr], arrlen[iarr]); - RETVAL += hash; - } - } -OUTPUT: - RETVAL - -U32 -run_PERL_HASH_FUNC_DJB2() -PREINIT: - int i; - int iarr; -CODE: -#undef PERL_HASH_FUNC -#undef PERL_HASH_SEED_BYTES -#undef PERL_HASH -#define PERL_HASH_FUNC "DJB2" -#define PERL_HASH_SEED_BYTES 4 -#define PERL_HASH(hash,str,len) (hash)= S_perl_hash_djb2(PERL_HASH_SEED,(U8*)(str),(len)) - RETVAL = 0; - for(i=0; i < 1000000; i++){ - for(iarr=0; iarr < sizeof(arrlen); iarr++){ - U32 hash; - PERL_HASH(hash, arr[iarr], arrlen[iarr]); - RETVAL += hash; - } - } -OUTPUT: - RETVAL - -U32 -run_PERL_HASH_FUNC_SUPERFAST() -PREINIT: - int i; - int iarr; -CODE: -#undef PERL_HASH_FUNC -#undef PERL_HASH_SEED_BYTES -#undef PERL_HASH -#define PERL_HASH_FUNC "SUPERFAST" -#define PERL_HASH_SEED_BYTES 4 -#define PERL_HASH(hash,str,len) (hash)= S_perl_hash_superfast(PERL_HASH_SEED,(U8*)(str),(len)) - RETVAL = 0; - for(i=0; i < 1000000; i++){ - for(iarr=0; iarr < sizeof(arrlen); iarr++){ - U32 hash; - PERL_HASH(hash, arr[iarr], arrlen[iarr]); - RETVAL += hash; - } - } -OUTPUT: - RETVAL - -U32 -run_PERL_HASH_FUNC_MURMUR3() -PREINIT: - int i; - int iarr; -CODE: -#undef PERL_HASH_FUNC -#undef PERL_HASH_SEED_BYTES -#undef PERL_HASH -#define PERL_HASH_FUNC "MURMUR3" -#define PERL_HASH_SEED_BYTES 4 -#define PERL_HASH(hash,str,len) (hash)= S_perl_hash_murmur3(PERL_HASH_SEED,(U8*)(str),(len)) - RETVAL = 0; - for(i=0; i < 1000000; i++){ - for(iarr=0; iarr < sizeof(arrlen); iarr++){ - U32 hash; - PERL_HASH(hash, arr[iarr], arrlen[iarr]); - RETVAL += hash; - } - } -OUTPUT: - RETVAL - -U32 -run_PERL_HASH_FUNC_ONE_AT_A_TIME() -PREINIT: - int i; - int iarr; -CODE: -#undef PERL_HASH_FUNC -#undef PERL_HASH_SEED_BYTES -#undef PERL_HASH -#define PERL_HASH_FUNC "ONE_AT_A_TIME" -#define PERL_HASH_SEED_BYTES 4 -#define PERL_HASH(hash,str,len) (hash)= S_perl_hash_one_at_a_time(PERL_HASH_SEED,(U8*)(str),(len)) - RETVAL = 0; - for(i=0; i < 1000000; i++){ - for(iarr=0; iarr < sizeof(arrlen); iarr++){ - U32 hash; - PERL_HASH(hash, arr[iarr], arrlen[iarr]); - RETVAL += hash; - } - } -OUTPUT: - RETVAL U32 run_PERL_HASH_FUNC_ONE_AT_A_TIME_HARD() @@ -207,26 +87,3 @@ CODE: } OUTPUT: RETVAL - -U32 -run_PERL_HASH_FUNC_ONE_AT_A_TIME_OLD() -PREINIT: - int i; - int iarr; -CODE: -#undef PERL_HASH_FUNC -#undef PERL_HASH_SEED_BYTES -#undef PERL_HASH -#define PERL_HASH_FUNC "ONE_AT_A_TIME_OLD" -#define PERL_HASH_SEED_BYTES 4 -#define PERL_HASH(hash,str,len) (hash)= S_perl_hash_old_one_at_a_time(PERL_HASH_SEED,(U8*)(str),(len)) - RETVAL = 0; - for(i=0; i < 1000000; i++){ - for(iarr=0; iarr < sizeof(arrlen); iarr++){ - U32 hash; - PERL_HASH(hash, arr[iarr], arrlen[iarr]); - RETVAL += hash; - } - } -OUTPUT: - RETVAL diff --git a/lib/Benchmark/Perl/CoreHashes.pm b/lib/Benchmark/Perl/CoreHashes.pm index f611c6c..3f4b42e 100755 --- a/lib/Benchmark/Perl/CoreHashes.pm +++ b/lib/Benchmark/Perl/CoreHashes.pm @@ -13,13 +13,7 @@ our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); our @EXPORT = qw( run_PERL_HASH_FUNC_SIPHASH - run_PERL_HASH_FUNC_SDBM - run_PERL_HASH_FUNC_DJB2 - run_PERL_HASH_FUNC_SUPERFAST - run_PERL_HASH_FUNC_MURMUR3 - run_PERL_HASH_FUNC_ONE_AT_A_TIME run_PERL_HASH_FUNC_ONE_AT_A_TIME_HARD - run_PERL_HASH_FUNC_ONE_AT_A_TIME_OLD ); our $VERSION = '0.02'; diff --git a/t/Benchmark-Perl-CoreHashes.t b/t/Benchmark-Perl-CoreHashes.t index a72ba04..a559233 100755 --- a/t/Benchmark-Perl-CoreHashes.t +++ b/t/Benchmark-Perl-CoreHashes.t @@ -11,13 +11,7 @@ BEGIN { use_ok('Benchmark::Perl::CoreHashes') }; my ($t1beg, $t1end); my @subnames = qw| PERL_HASH_FUNC_SIPHASH - PERL_HASH_FUNC_SDBM - PERL_HASH_FUNC_DJB2 - PERL_HASH_FUNC_SUPERFAST - PERL_HASH_FUNC_MURMUR3 - PERL_HASH_FUNC_ONE_AT_A_TIME PERL_HASH_FUNC_ONE_AT_A_TIME_HARD - PERL_HASH_FUNC_ONE_AT_A_TIME_OLD |; #disabled to make results easier to read for now #@subnames = shuffle @subnames; -- 2.12.0
Subject: 0002-Add-siphash13-and-hybrid-siphash13.patch
From 18fe79aa118580ddf22aba589e6fd897de6fe46b Mon Sep 17 00:00:00 2001 From: Kent Fredric <kentfredric@gmail.com> Date: Fri, 17 Mar 2017 23:02:56 +1300 Subject: Add siphash13 and hybrid siphash13 --- CoreHashes.xs | 50 +++++++++++++++++++++++++++++++++++++++- lib/Benchmark/Perl/CoreHashes.pm | 2 ++ t/Benchmark-Perl-CoreHashes.t | 2 ++ 3 files changed, 53 insertions(+), 1 deletion(-) diff --git a/CoreHashes.xs b/CoreHashes.xs index 9f3acc1..2a51cc3 100755 --- a/CoreHashes.xs +++ b/CoreHashes.xs @@ -35,6 +35,8 @@ static const char arrlen [] = { #undef PERL_HASH_FUNC_SIPHASH #undef PERL_HASH_FUNC_ONE_AT_A_TIME_HARD +#undef PERL_HASH_FUNC_SIPHASH13 +#undef PERL_HASH_FUNC_HYBRID_OAATHU_SIPHASH13 #undef PERL_HASH_SEED #define PERL_HASH_SEED "PeRlHaShhAcKpErl" @@ -64,7 +66,6 @@ CODE: OUTPUT: RETVAL - U32 run_PERL_HASH_FUNC_ONE_AT_A_TIME_HARD() PREINIT: @@ -87,3 +88,50 @@ CODE: } OUTPUT: RETVAL + +U32 +run_PERL_HASH_FUNC_SIPHASH13() +PREINIT: + int i; + int iarr; +CODE: +#undef PERL_HASH_FUNC +#undef PERL_HASH_SEED_BYTES +#undef PERL_HASH +#define PERL_HASH_FUNC "SIPHASH_1_3" +#define PERL_HASH_SEED_BYTES 16 +#define PERL_HASH(hash,str,len) (hash)= S_perl_hash_siphash_1_3(PERL_HASH_SEED,(U8*)(str),(len)) + RETVAL = 0; + for(i=0; i < 1000000; i++){ + for(iarr=0; iarr < sizeof(arrlen); iarr++){ + U32 hash; + PERL_HASH(hash, arr[iarr], arrlen[iarr]); + RETVAL += hash; + } + } +OUTPUT: + RETVAL + +U32 +run_PERL_HASH_FUNC_HYBRID_OAATHU_SIPHASH13() +PREINIT: + int i; + int iarr; +CODE: +#undef PERL_HASH_FUNC +#undef PERL_HASH_SEED_BYTES +#undef PERL_HASH +#define PERL_HASH_FUNC "HYBRID_OAATHU_SIPHASH_1_3" +#define PERL_HASH_SEED_BYTES 24 +#define PERL_HASH(hash,str,len) (hash)= S_perl_hash_oaathu_siphash_1_3(PERL_HASH_SEED,(U8*)(str),(len)) + RETVAL = 0; + for(i=0; i < 1000000; i++){ + for(iarr=0; iarr < sizeof(arrlen); iarr++){ + U32 hash; + PERL_HASH(hash, arr[iarr], arrlen[iarr]); + RETVAL += hash; + } + } +OUTPUT: + RETVAL + diff --git a/lib/Benchmark/Perl/CoreHashes.pm b/lib/Benchmark/Perl/CoreHashes.pm index 3f4b42e..e493fc8 100755 --- a/lib/Benchmark/Perl/CoreHashes.pm +++ b/lib/Benchmark/Perl/CoreHashes.pm @@ -14,6 +14,8 @@ our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); our @EXPORT = qw( run_PERL_HASH_FUNC_SIPHASH run_PERL_HASH_FUNC_ONE_AT_A_TIME_HARD + run_PERL_HASH_FUNC_SIPHASH13 + run_PERL_HASH_FUNC_HYBRID_OAATHU_SIPHASH13 ); our $VERSION = '0.02'; diff --git a/t/Benchmark-Perl-CoreHashes.t b/t/Benchmark-Perl-CoreHashes.t index a559233..ffd1520 100755 --- a/t/Benchmark-Perl-CoreHashes.t +++ b/t/Benchmark-Perl-CoreHashes.t @@ -12,6 +12,8 @@ my ($t1beg, $t1end); my @subnames = qw| PERL_HASH_FUNC_SIPHASH PERL_HASH_FUNC_ONE_AT_A_TIME_HARD + PERL_HASH_FUNC_SIPHASH13 + PERL_HASH_FUNC_HYBRID_OAATHU_SIPHASH13 |; #disabled to make results easier to read for now #@subnames = shuffle @subnames; -- 2.12.0