At 16:03 Uhr +0100 23.01.2003, Paul Gaborit wrote:
Wow - seems we spend a *lot* of time in expand_percent! If we can optimize that function and/or reduce the places in which it is used, that might indeed pay off well.
The patch below should be appropriate.

--- /sw/lib/perl5/Fink/Services.pm.orig	Tue Jan 14 22:46:15 2003
+++ /sw/lib/perl5/Fink/Services.pm.new	Thu Jan 23 15:58:28 2003
@@ -272,9 +272,8 @@
   # which do stuff like %N = %n-shlibs). Hence we repeate the expansion
   # if necessary.
   for ($i = 0; $i < 2 ; $i++) {
-    while (($key, $value) = each %$map) {
-      $s =~ s/\%$key/$value/g;
-    }
+    my $percent_keys = join('|', keys %$map);
+    $s =~ s/\%($percent_keys)/$map->{$1}/eg;
     last if not $s =~ /\%/; # Abort early if no percent symbols are left
   }
Not bad at all. "sudo fink list -o" with a dirty DB went from 37s to 21s (I tried each twice, with about the same numbers each time). With a non-dirty DB, the timing stayed identical (3s) on this machine.

I'll check this in ASAP. Thaks a lot, Paul!


Max


-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
Fink-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/fink-devel

Reply via email to