]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
So _that's_ why mkfiles.pl was running so slowly on my Windows box!
authorSimon Tatham <anakin@pobox.com>
Sat, 17 Jan 2004 13:24:59 +0000 (13:24 +0000)
committerSimon Tatham <anakin@pobox.com>
Sat, 17 Jan 2004 13:24:59 +0000 (13:24 +0000)
&findfile() now caches its results. At least one full order of
magnitude speedup when running on an SMB-mounted volume. Phew.

[originally from svn r3720]

mkfiles.pl

index 30bd680db024178badc43af59f1fd04241d0196b..652d2ecfa71d28a544ba63d7c0c715e18f65610c 100755 (executable)
@@ -184,12 +184,15 @@ foreach $i (keys %depends) {
 sub findfile {
   my ($name) = @_;
   my $dir, $i, $outdir = "";
-  $i = 0;
-  foreach $dir (@incdirs) {
-    $outdir = $dir, $i++ if -f "$dir$name";
+  unless (defined $findfilecache{$name}) {
+    $i = 0;
+    foreach $dir (@incdirs) {
+      $outdir = $dir, $i++ if -f "$dir$name";
+    }
+    die "multiple instances of source file $name\n" if $i > 1;
+    $findfilecache{$name} = $outdir . $name;
   }
-  die "multiple instances of source file $name\n" if $i > 1;
-  return "$outdir$name";
+  return $findfilecache{$name};
 }
 
 sub objects {