in reply to Speeding up a Perl code. Can it be faster?

Hello $h4X4_|=73}{,

These lines look strange to me:

if (exists $xlist{$name} && defined $xlist{$name}) { $xlist{$name} = undef; # this exists now

However, if the logic is correct, you can gain a little speedup by removing the first test:

if (defined $xlist{$name}) {

Testing for definedness on a non-existent hash entry doesn’t raise a warning, and won’t trigger autovivification, as the following demonstrates:

22:44 >perl -Mstrict -MData::Dump -wE "my %h = (a => 1, b => undef); d +d \%h; say $_, defined $h{$_} ? ': yes' : ': no' for qw(a b c); dd \% +h;" { a => 1, b => undef } a: yes b: no c: no { a => 1, b => undef } 22:47 >

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,