Hi!
I found this on the easy hacks page:
http://wiki.documentfoundation.org/Development/Easy_Hacks
The attached patch makes make_installer.pl save up to 25% time on my
linux machine.
I'm going to do some more patching on make_installer.pl. Is it okay
to post my patches on this mailing list?
From 9aae3df44545965681254655fae5c9c69c4e0b34 Mon Sep 17 00:00:00 2001
From: Jan Darmochwal <jdarmochwal@gmx.de>
Date: Thu, 27 Jan 2011 00:41:19 +0100
Subject: [PATCH] Accelerate Perl installer builder
speed up collect_directories_from_filesarray
eg use $a .= $b instead of $a = $a . $b
---
solenv/bin/modules/installer/scriptitems.pm | 79 +++++++--------------------
1 files changed, 19 insertions(+), 60 deletions(-)
diff --git a/solenv/bin/modules/installer/scriptitems.pm
b/solenv/bin/modules/installer/scriptitems.pm
index 3c436eb..a83e377 100644
--- a/solenv/bin/modules/installer/scriptitems.pm
+++ b/solenv/bin/modules/installer/scriptitems.pm
@@ -2093,17 +2093,13 @@ sub optimize_list
{
my ( $longlist ) = @_;
my %tmpHash;
- my $shortlist = "";
- $longlist =~ s/^\s*|\s*$//g;
+ $longlist =~ s/^\s+//;
+ $longlist =~ s/\s+$//;
$longlist =~ s/\s*,\s*/,/g;
- foreach ( split /,/, $longlist ) { $tmpHash{$_} = 1; }
-
- foreach (sort keys %tmpHash ) { $shortlist .= "$_,"; }
- chop( $shortlist );
-
- return $shortlist;
+ @tmpHash{split /,/, $longlist} = ();
+ return join(",", sort keys %tmpHash);
}
#######################################################################
@@ -2126,7 +2122,6 @@ sub collect_directories_from_filesarray
my %alldirectoryhash = ();
my $predefinedprogdir_added = 0;
- my $alreadyincluded = 0;
# Preparing this already as hash, although the only needed value at the moment is the HostName
# But also adding: "specificlanguage" and "Dir" (for instance gid_Dir_Program)
@@ -2138,62 +2133,26 @@ sub collect_directories_from_filesarray
installer::pathanalyzer::get_path_from_fullqualifiedname(\$destinationpath);
$destinationpath =~ s/\Q$installer::globals::separator\E\s*$//; # removing
ending slashes or backslashes
- $alreadyincluded = 0;
- if ( exists($alldirectoryhash{$destinationpath}) ) { $alreadyincluded = 1; }
-
- if (!($alreadyincluded))
+ do
{
- my %directoryhash = ();
- $directoryhash{'HostName'} = $destinationpath;
- $directoryhash{'specificlanguage'} = $onefile->{'specificlanguage'};
- $directoryhash{'Dir'} = $onefile->{'Dir'};
- $directoryhash{'modules'} = $onefile->{'modules'}; # NEW, saving modules
+ if (!exists($alldirectoryhash{$destinationpath}))
+ {
+ my %directoryhash = ();
+ $directoryhash{'HostName'} = $destinationpath;
+ $directoryhash{'specificlanguage'} = $onefile->{'specificlanguage'};
+ $directoryhash{'Dir'} = $onefile->{'Dir'};
+ $directoryhash{'modules'} = $onefile->{'modules'}; # NEW, saving modules
- if ( $onefile->{'Dir'} eq "PREDEFINED_PROGDIR" ) { $predefinedprogdir_added = 1; }
-
- $alldirectoryhash{$destinationpath} = \%directoryhash;
-
- # Problem: The $destinationpath can be share/registry/schema/org/openoffice
- # but not all directories contain files and will be added to this list.
- # Therefore the path has to be analyzed.
-
- while ( $destinationpath =~ /(^.*\S)\Q$installer::globals::separator\E(\S.*?)\s*$/ )
# as long as the path contains slashes
- {
- $destinationpath = $1;
-
- $alreadyincluded = 0;
- if ( exists($alldirectoryhash{$destinationpath}) ) { $alreadyincluded = 1; }
-
- if (!($alreadyincluded))
- {
- my %directoryhash = ();
-
- $directoryhash{'HostName'} = $destinationpath;
- $directoryhash{'specificlanguage'} = $onefile->{'specificlanguage'};
- $directoryhash{'Dir'} = $onefile->{'Dir'};
- $directoryhash{'modules'} = $onefile->{'modules'}; # NEW, saving modules
+ $predefinedprogdir_added ||= $onefile->{'Dir'} eq "PREDEFINED_PROGDIR";
- $alldirectoryhash{$destinationpath} = \%directoryhash;
- }
- else
- {
- # Adding the modules to the module list!
- $alldirectoryhash{$destinationpath}->{'modules'} =
$alldirectoryhash{$destinationpath}->{'modules'} . "," . $onefile->{'modules'};
- }
+ $alldirectoryhash{$destinationpath} = \%directoryhash;
}
- }
- else
- {
- # Adding the modules to the module list!
- $alldirectoryhash{$destinationpath}->{'modules'} =
$alldirectoryhash{$destinationpath}->{'modules'} . "," . $onefile->{'modules'};
-
- # Also adding the module to all parents
- while ( $destinationpath =~ /(^.*\S)\Q$installer::globals::separator\E(\S.*?)\s*$/ )
# as long as the path contains slashes
- {
- $destinationpath = $1;
- $alldirectoryhash{$destinationpath}->{'modules'} =
$alldirectoryhash{$destinationpath}->{'modules'} . "," . $onefile->{'modules'};
+ else
+ {
+ # Adding the modules to the module list!
+ $alldirectoryhash{$destinationpath}->{'modules'} .= "," . $onefile->{'modules'};
}
- }
+ } while ($destinationpath =~ s/(^.*\S)\Q$installer::globals::separator\E(\S.*?)\s*$/$1/);
# as long as the path contains slashes
}
# if there is no file in the root directory PREDEFINED_PROGDIR, it has to be included into the
directory array now
--
1.7.1
Context
- [Libreoffice] [Patch] Accelerate Perl installer builder · Jan Darmochwal
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.