perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philippe M. Chiasson" <go...@ectoplasm.org>
Subject Re: [PATCH] Apache2::Reload
Date Mon, 22 Aug 2005 17:44:38 GMT
Geoffrey Young wrote:
>>-    while (my($key, $file) = each %Apache2::Reload::INCS) {
>>+    foreach my $key (sort { $a cmp $b } keys %Apache2::Reload::INCS) {
>>+        my $file = $Apache2::Reload::INCS{$key};
> 
> I hate each.

each is perfect when iterating over a large hash and not caring about ordering.
Doesn't need to build a large array to hold _all_ the keys, so it's a major
speed improvement.

I am not sure what is gained here by sorting ?

--------------------------------------------------------------------------------
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/     F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5

Mime
View raw message