Bugzilla – Attachment 106369 Details for
Bug 25889
Increase performance of debian/list-deps script
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25889: Increase performance of debian/list-deps script
Bug-25889-Increase-performance-of-debianlist-deps-.patch (text/plain), 3.13 KB, created by
Mason James
on 2020-06-29 02:01:58 UTC
(
hide
)
Description:
Bug 25889: Increase performance of debian/list-deps script
Filename:
MIME Type:
Creator:
Mason James
Created:
2020-06-29 02:01:58 UTC
Size:
3.13 KB
patch
obsolete
>From 1624984dc4fcf73828bd8d6580364989063f8c56 Mon Sep 17 00:00:00 2001 >From: Mason James <mtj@kohaaloha.com> >Date: Mon, 29 Jun 2020 13:40:36 +1200 >Subject: [PATCH] Bug 25889: Increase performance of debian/list-deps script >Content-Type: text/plain; charset="utf-8" > >to test... (on a i7-2600 vm with 8 cores) > >1/ run script, note execution time > $ time ./debian/update-control > real 8m5.000s > >2/ copy old file > $ cp ./debian/control control.old > >3/ apply patch > >4/ run updated script, note execution time is smaller > $ time ./debian/update-control > real 2m14.000s > >4/ copy new file > $ cp ./debian/control control.new > >5/ confirm old and new control files are identical > $ diff control.old control.new | wc -l > 0 >--- > debian/list-deps | 25 +++++++++++++------------ > 1 file changed, 13 insertions(+), 12 deletions(-) > >diff --git a/debian/list-deps b/debian/list-deps >index 4bf9367..68f3b60 100755 >--- a/debian/list-deps >+++ b/debian/list-deps >@@ -18,6 +18,8 @@ > # along with this program. If not, see <http://www.gnu.org/licenses/>. > > use Modern::Perl; >+use Parallel::ForkManager; >+use Sys::CPU; > > use C4::Installer::PerlModules; > >@@ -42,15 +44,22 @@ my %ignore = ( > > my $prefix = "^/usr/((lib|share)/perl5|(lib|share)/perl/[0-9.]+|(lib|share)/.*-linux-gnu.*/perl/[0-9.]+|(lib|share)/.*-linux-gnu.*/perl5/[0-9.]+)"; > >+my $pm = new Parallel::ForkManager( Sys::CPU::cpu_count() ); >+ > my $modules = C4::Installer::PerlModules->new(); > my $prereqs = $modules->prereqs; > foreach my $phase ($prereqs->phases) { > foreach my $type ($prereqs->types_in($phase)) { > my $reqs = $prereqs->requirements_for($phase, $type); >+ >+ MODULE_LOOP: > foreach my $module ( $reqs->required_modules ) { >+ my $pid = $pm->start and next MODULE_LOOP; >+ > next if $ignore{$module}; > my $subpath = $module; > $subpath =~ s,::,/,g; >+ > my $output = qx(apt-file -l -x search "$prefix/$subpath.pm\$"); > my @temp = split( /\n/, $output ); > my @lines = (); >@@ -83,18 +92,7 @@ foreach my $phase ($prereqs->phases) { > print "\n"; > } > elsif ( scalar(@temp) != 0 ) { >- >- # I'm an Essential and I'm OK, >- # I install all night, and work all day. >- # I chomp up strings. I eat my bugs. >- # I go to the base install. >- # On Fridays I go drinking, >- # and have buttered commits for git. >- # (Beer O'Clock is more than two hours >- # away. I don't even drink beer. There >- # is no reason to be suspicious of this >- # commit.) >- # RM note: suspicious? me? always! >+ # hmm, skip module > } > elsif ( $type ne 'requires' ) { > # Ignore because we don't have it and we don't care. >@@ -102,6 +100,9 @@ foreach my $phase ($prereqs->phases) { > else { > print "EEEK: unknown package for $module\n"; > } >+ >+ $pm->finish; # Terminates the child process > } > } > } >+$pm->wait_all_children; >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 25889
:
106369
|
106370
|
107345