http://www.perlmonks.org?node_id=1016391


in reply to Re^2: Speed up hash initialization loop
in thread Speed up hash initialization loop

How large will @$vars be? If larger than a hundred elements or so, you will benefit from a Schwartzian transform:

my @sorted_vars = map { $_->[1] } sort { $a->[0] cmp $b->[0] } map { [ lc $_, $_ ] } @{$vars};

I'm afraid I'm as out of ideas as the other posters here -- your only recourse is to use a profiler and find the bottlenecks that way.