Another performance improvement for the perl installer. This one brought my ./bin/ooinstall -l <dirname> time down from about 4 1/2 minutes to under 4 minutes. (Warning: that number is in the right ballpark, but is from a very small number of install runs.) The only functional change was to trim all leading/trailing whitespace from the list elements before eliminating duplicates (the old function only checks half of the leading/trailing edges, and which edge depends on where in the list the element came from; I couldn't find a good reason for that pattern, so I made it uniform).
I'm finding the NYTProf module useful for finding performance bottlenecks in the perl code, although on my system the times seem to bloat out by a factor of 3 or so with the profiler running. LGPLv3+/MPL. Jordan Ayers
From 7d6e4413d90f9e7bc6451b89fe3c481a303279de Mon Sep 17 00:00:00 2001 From: Jordan Ayers <jordan.ay...@gmail.com> Date: Tue, 30 Nov 2010 22:36:28 -0600 Subject: [PATCH] Accelerate perl installer: optimize installer::scriptitems::optimize_list(). Replace call to convert_stringlist_into_hash with a simpler method using split; this requires significantly fewer data copy operations. The new routine strips all whitespace from the front and end of each value; the old function call stripped leading whitespace, most of the time. --- solenv/bin/modules/installer/scriptitems.pm | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/solenv/bin/modules/installer/scriptitems.pm b/solenv/bin/modules/installer/scriptitems.pm index b96b77b..6ba76fe 100644 --- a/solenv/bin/modules/installer/scriptitems.pm +++ b/solenv/bin/modules/installer/scriptitems.pm @@ -2031,11 +2031,16 @@ sub quoting_illegal_filenames sub optimize_list { my ( $longlist ) = @_; - + my %tmpHash; my $shortlist = ""; - my $hashref = installer::converter::convert_stringlist_into_hash(\$longlist, ","); - foreach my $key (sort keys %{$hashref} ) { $shortlist = "$shortlist,$key"; } - $shortlist =~ s/^\s*\,//; + + $longlist =~ s/^\s*|\s*$//g; + $longlist =~ s/\s*,\s*/,/g; + + foreach ( split /,/, $longlist ) { $tmpHash{$_} = 1; } + + foreach (sort keys %tmpHash ) { $shortlist .= "$_,"; } + chop( $shortlist ); return $shortlist; } -- 1.7.1
_______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice