[Libreoffice] [PATCH][PARTIAL PUSH] More perl cleanup (fdo#39747)

Norbert Thiebaud nthiebaud at gmail.com
Fri Aug 12 22:52:58 PDT 2011


On Fri, Aug 12, 2011 at 11:14 PM, Jordan Ayers <jordan.ayers at gmail.com> wrote:
> A few more patches to clean up parts of the solenv perl scripts.
>
> The first is just removing pieces that became useless after prior
> patches, or that were added as part of a larger patch, even though
> they were never used.  (I'm basing this on the master branch git log
> entries.)

Applied and pushed, thanks.

>
> The second has a minor impact on build.pl calling behavior, but seems
> reasonable.  The --dontgraboutput switch hasn't done anything for some
> time, except cause build.pl to abort if this switch was specified
> before the --html switch.  If specified now, it will pass through to
> the dmake options (where it shouldn't do anything); it can no longer
> prevent build.pl from running.

Applied and push, thanks.

>
> The last just shortens the debuginfo / debugsave calls; since every
> time these were used, they were wrapped in checks against the debug
> flag, I pushed the debug flag check into those routines.  Now they can
> just be called, and if debugging is off they do nothing.

Actually this 'shorten' their appearance, but lengthen their execution.
Indeed before the cost of call to debuginfo/debugsave in non debug case, was

if(variable = true)

with this patch it is:

Evaluate the argument of the call, make the function call,
if(variable=true) return to the caller

This can be very bad (see example below), and can never be faster.

So I have not pushed this one.

Norbert

-----

example:

#! /usr/bin/perl -w

use strict;

my $mode = $ARGV[0];
my $debug = $ARGV[2];

my %foo =();

$foo{'s'} = "bar";
$foo{'f'} = "foo";

if(!defined($debug))
{
    $debug = 0;
}

sub sdebug
{
    my ($message) = @_;
    if($debug)
    {
        print $message;
    }
}
sub fdebug
{
    my ($message) = @_;
};

if($mode eq "f")
{
    for(my $i = 0; $i < 100000; $i++)
    {
        if($debug)
        {
            fdebug("message $i $foo{$mode} $#ARGV\n");
        }
    }
}
else
{
    for(my $i = 0; $i < 100000; $i++)
    {
        sdebug("message $i $foo{$mode} $#ARGV\n");
    }
}


n_th at tpamac ~/bin $time tperfperl.pl s

real	0m0.180s
user	0m0.173s
sys	0m0.006s
n_th at tpamac ~/bin $time tperfperl.pl s

real	0m0.178s
user	0m0.171s
sys	0m0.006s
n_th at tpamac ~/bin $time tperfperl.pl s

real	0m0.177s
user	0m0.171s
sys	0m0.006s
n_th at tpamac ~/bin $time tperfperl.pl f

real	0m0.017s
user	0m0.010s
sys	0m0.006s
n_th at tpamac ~/bin $time tperfperl.pl f

real	0m0.018s
user	0m0.010s
sys	0m0.006s
n_th at tpamac ~/bin $time tperfperl.pl f

real	0m0.017s
user	0m0.010s
sys	0m0.006s


More information about the LibreOffice mailing list