shrink memory used by building only one single list per set of pkgnames.
Also use a simple `seen' cache for files only used by one package, since they cannot participate in actual conflicts. Shrinks memory for 250M to 190M, with no negative speed effects.
This commit is contained in:
parent
2c777132fd
commit
4d3e4bb38e
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
|
|
||||||
# $OpenBSD: find-all-conflicts,v 1.13 2007/04/10 21:36:26 espie Exp $
|
# $OpenBSD: find-all-conflicts,v 1.14 2007/04/16 14:36:25 espie Exp $
|
||||||
# Copyright (c) 2000-2005
|
# Copyright (c) 2000-2005
|
||||||
# Marc Espie. All rights reserved.
|
# Marc Espie. All rights reserved.
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
@ -45,12 +45,30 @@ sub register
|
|||||||
|
|
||||||
package OpenBSD::PackingElement::FileBase;
|
package OpenBSD::PackingElement::FileBase;
|
||||||
|
|
||||||
|
my $pkg_list = {};
|
||||||
|
my $seen = {};
|
||||||
|
|
||||||
sub register
|
sub register
|
||||||
{
|
{
|
||||||
my ($self, $all_conflict, $all_deps, $pkgname) = @_;
|
my ($self, $all_conflict, $all_deps, $pkgname) = @_;
|
||||||
|
|
||||||
my $file= File::Spec->canonpath($self->fullname());
|
my $file= File::Spec->canonpath($self->fullname());
|
||||||
push @{$all_conflict->{$file}}, $pkgname;
|
# build one single list for each pkgnames combination
|
||||||
|
if (exists $all_conflict->{$file}) {
|
||||||
|
$pkg_list->{$all_conflict->{$file}}->{$pkgname} ||=
|
||||||
|
[@{$all_conflict->{$file}}, $pkgname ];
|
||||||
|
$all_conflict->{$file} =
|
||||||
|
$pkg_list->{$all_conflict->{$file}}->{$pkgname};
|
||||||
|
} elsif (exists $seen->{$file}) {
|
||||||
|
$pkg_list->{$seen->{$file}}->{$pkgname} ||=
|
||||||
|
[ @{$seen->{$file}}, $pkgname ];
|
||||||
|
$all_conflict->{$file} =
|
||||||
|
$pkg_list->{$seen->{$file}}->{$pkgname};
|
||||||
|
delete $seen->{$file};
|
||||||
|
} else {
|
||||||
|
$pkg_list->{$pkgname} ||= [$pkgname];
|
||||||
|
$seen->{$file} = $pkg_list->{$pkgname};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
package OpenBSD::PackingElement::Depend;
|
package OpenBSD::PackingElement::Depend;
|
||||||
|
Loading…
Reference in New Issue
Block a user