* Huge speedup in patch propagation (20 minutes or so to 3 seconds).

This commit is contained in:
Eelco Dolstra 2007-01-08 15:17:18 +00:00
parent 4c63f9fe04
commit 50bdec410a

View file

@ -348,11 +348,22 @@ foreach my $p (keys %dstOutPaths) {
# patches that produce either paths in the destination or paths that # patches that produce either paths in the destination or paths that
# can be used as the base for other useful patches). # can be used as the base for other useful patches).
print "propagating patches...\n";
my $changed; my $changed;
do { do {
# !!! we repeat this to reach the transitive closure; inefficient # !!! we repeat this to reach the transitive closure; inefficient
$changed = 0; $changed = 0;
print "loop\n";
my %dstBasePaths;
foreach my $q (keys %dstPatches) {
foreach my $patch (@{$dstPatches{$q}}) {
$dstBasePaths{$patch->{basePath}} = 1;
}
}
foreach my $p (keys %srcPatches) { foreach my $p (keys %srcPatches) {
my $patchList = $srcPatches{$p}; my $patchList = $srcPatches{$p};
@ -360,16 +371,12 @@ do {
# Is path $p included in the destination? If so, include # Is path $p included in the destination? If so, include
# patches that produce it. # patches that produce it.
$include = 1 if (defined $dstNarFiles{$p}); $include = 1 if defined $dstNarFiles{$p};
# Is path $p a path that serves as a base for paths in the # Is path $p a path that serves as a base for paths in the
# destination? If so, include patches that produce it. # destination? If so, include patches that produce it.
foreach my $q (keys %dstPatches) {
foreach my $patch (@{$dstPatches{$q}}) {
# !!! check baseHash # !!! check baseHash
$include = 1 if ($p eq $patch->{basePath}); $include = 1 if defined $dstBasePaths{$p};
}
}
if ($include) { if ($include) {
foreach my $patch (@{$patchList}) { foreach my $patch (@{$patchList}) {