lkml.org 
[lkml]   [1996]   [Sep]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: Perl make depend made faster
On my 486 DX2/66 SCSI-2 with 20 Mb, depend.awk took 3:34 wall clock (best
time), depend.pl took 2:30 (worst time). A couple of tweaks to depend.pl
knocked that down even more, to 2:07.

Doing "undef $/;" and replacing "$program = join '', <FILE>' with "$program =
<FILE>;" took 20 seconds off the wall clock. Removing all "my" keywords took
out another second or so.

Unfortunately the technique "foreach $file (@ARGV); ... push(@ARGV,$rfname);"
does not work. The "foreach" list is evaluated once, new files are pushed
onto @ARGV but never actually processed (perl 5.001m). This results in
missing dependencies in /drivers/sbus/char/.depend.

Speed up patch and correction to ARGV list follow.

--- depend.pl.orig Sun Sep 15 00:58:43 1996
+++ depend.pl Sun Sep 15 00:37:18 1996
@@ -19,19 +19,24 @@
my @parray = split( ' ' , $ENV{"HPATH"} );
grep ( do { s/^I//; s/[\/\s]*$/\//; } && 0 , @parray );

+# swallow entire files at a single gulp
+
+undef $/;
+

# Iterate on input files


-foreach $file ( @ARGV ) {
+for ($i = 0; $i <= $#ARGV; ++$i) {
+ $file = $ARGV[$i];


# Sensible if boring initializations ..


- my $hasdep = 0, $hasconfig = 0, $needsconfig = 0;
- my $cmd = '', $depname = '', $relpath = '';
- my @includes = ();
+ $hasdep = 0, $hasconfig = 0, $needsconfig = 0;
+ $cmd = '', $depname = '', $relpath = '';
+ @includes = ();


# Massage filename into $depname, $relpath, $cmd
@@ -52,7 +57,7 @@


open ( FILE, $file ) or die "Can't open $file: $!\n";
- $program = join '', <FILE>;
+ $program = <FILE>;
close FILE;





\
 
 \ /
  Last update: 2005-03-22 13:38    [W:0.111 / U:37.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site