[Chicago-talk] appending hashes
Andy_Bach at wiwb.uscourts.gov
Andy_Bach at wiwb.uscourts.gov
Tue Nov 4 09:51:32 CST 2003
Interestingly (???) the map method:
'mapappend' => sub
{
%a = %b;
%a = map {$_ => $c{$_} } keys(%c);
},
is slower and gets worse as the hashes get bigger. I bumped up c to:
%c = map(($_, $_), 0 .. 6750);
and:
Benchmark: timing 1000 iterations of append, baseline, mapappend...
append: 36 wallclock secs (33.94 usr + 0.22 sys = 34.16 CPU) @
29.27/s (n=1000)
baseline: 2 wallclock secs ( 2.08 usr + 0.02 sys = 2.10 CPU) @
476.19/s (n=1000)
mapappend: 65 wallclock secs (61.32 usr + 0.58 sys = 61.90 CPU) @
16.16/s (n=1000)
(left off unroll as it was really slow). Looks like slices are the way to
go.
a
Andy Bach, Sys. Mangler
Internet: andy_bach at wiwb.uscourts.gov
VOICE: (608) 261-5738 FAX 264-5030
"I'm not sure what LInux-friendly means"
Martin Taylor, MicroSoft's Linux strategist
More information about the Chicago-talk
mailing list