develooper Front page | perl.perl5.porters | Postings from August 2012

RE: Slowdown in longer hash keys

Thread Previous | Thread Next
From:
bulk 88
Date:
August 24, 2012 14:27
Subject:
RE: Slowdown in longer hash keys
Message ID:
COL115-W112F6D863524FFEEFBAC96DFBD0@phx.gbl



----------------------------------------
> Date: Fri, 24 Aug 2012 14:14:50 -0600
> From: public@khwilliamson.com
> To: perl5-porters@perl.org
> Subject: Slowdown in longer hash keys
>
> It appears to me that the length of the keys had an outsize impact on
> performance.



I'll point this out 
http://perl5.git.perl.org/perl.git/blob/3f6a9d3a9cabfeb160740fe70d8f9efa589304f0:/hv.c#l639
 . I wrote some code to take advantage of that specific block of code so
 (my) XS code would have faster hash access. I threw the code into a 
CPAN module. A real world perf difference was noticed on CPAN Testers 
although the benchmarking is very crude and I have no idea what the perf
 difference % of the actual call to hv_common_key_len is.



http://www.cpantesters.org/cpan/report/c6723890-c2b7-1017-905d-849c05085451



Windows Computer

_____________________________

# time for old way was 7.109375

# time for new way was 6.59374594688416

_____________________________



http://www.cpantesters.org/cpan/report/fdfa95be-b411-11e1-92e2-6ae2756b88d3



OS X Computer

_____________________________

# time for old way was 13.8912332057953

# time for new way was 12.266753911972

_____________________________



I accidentally wrote the CPAN module in Microsoft C not ANSI C so it didn't compile on any modern GCCs.



I hope this post helped you somehow.
 		 	   		  
Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About