[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Minor file checking optimization: set_dir_cache_file.
From: |
Ralf Wildenhues |
Subject: |
Minor file checking optimization: set_dir_cache_file. |
Date: |
Sun, 26 Oct 2008 18:59:21 +0100 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
This patch has a bit nonobvious consequences. The
dir_has_case_matching_file function in FileUtils.pm maintains a
directory entry cache, and when we install an aux file, automake
simply forgets the cache for that directory. This optimization
simply updates the cache with the knowledge we have: new file,
no other changes.
The change can help to uncover code paths where files are changed
behind automake's back (for example from another thread), which I
consider a Good Thing.
FWIW, this is really a minor optimization with no visible speed
benefits.
Pushed to master.
Cheers,
Ralf
Minor file checking optimization: set_dir_cache_file.
* lib/Automake/FileUtils.pm (set_dir_cache_file): New function.
* automake.in (require_file_internal): Instead of resetting the
cache when a file has been installed, simply correct the cache
using set_dir_cache_file.
diff --git a/automake.in b/automake.in
index fea0906..fabeb48 100755
--- a/automake.in
+++ b/automake.in
@@ -7387,7 +7387,7 @@ sub require_file_internal ($$$@)
$suppress = 0;
$trailer = "\n error while copying";
}
- reset_dir_cache ($dir);
+ set_dir_cache_file ($dir, $file);
}
if (! maybe_push_required_file (dirname ($fullfile),
diff --git a/lib/Automake/FileUtils.pm b/lib/Automake/FileUtils.pm
index 2200be0..facde3f 100644
--- a/lib/Automake/FileUtils.pm
+++ b/lib/Automake/FileUtils.pm
@@ -47,7 +47,9 @@ use vars qw (@ISA @EXPORT);
@EXPORT = qw (&open_quote &contents
&find_file &mtime
&update_file &up_to_date_p
- &xsystem &xsystem_hint &xqx &dir_has_case_matching_file
&reset_dir_cache);
+ &xsystem &xsystem_hint &xqx
+ &dir_has_case_matching_file &reset_dir_cache
+ &set_dir_cache_file);
=item C<open_quote ($file_name)>
@@ -416,6 +418,19 @@ sub reset_dir_cache ($)
delete $_directory_cache{$_[0]};
}
+=item C<set_dir_cache_file ($dirname, $file_name)>
+
+State that C<$dirname> contains C<$file_name> now.
+
+=cut
+
+sub set_dir_cache_file ($$)
+{
+ my ($dirname, $file_name) = @_;
+ $_directory_cache{$dirname}{$file_name} = 1
+ if exists $_directory_cache{$dirname};
+}
+
1; # for require
### Setup "GNU" style for perl-mode and cperl-mode.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Minor file checking optimization: set_dir_cache_file.,
Ralf Wildenhues <=