#543477 perl-base: perl -e 'use Getopt::Long; ' takes ~1 second on an openmoko neo freerunner

Package:
perl-base
Source:
perl
Description:
minimal Perl system
Submitter:
Timo Juhani Lindfors
Date:
2010-11-08 08:24:08 UTC
Severity:
wishlist
#543477#5
Date:
2009-08-25 08:57:42 UTC
From:
To:
This is a wishlist bug. I wish I could parse long options with perl on
an openmoko neo freerunner faster. I do not have much insight on
profiling perl but I thought I should report this issue here so that
other people are aware of it.

Currently Getopt::Long is takes about four times longer to start than
Getopt::Std and totals to about one second:

lindi@ginger:~$ time perl -e 'use Getopt::Long;'

real    0m1.004s
user    0m0.865s
sys     0m0.120s

lindi@ginger:~$ time perl -e 'use Getopt::Std;'

real    0m0.228s
user    0m0.150s
sys     0m0.075s

This is very unfortunate as it forces one to either use cryptic short
options, suffer significant slowdown or resolt to writing a shell
script that can use the fast getopt binary:

lindi@ginger:~$ time getopt -o v --long verbose -- "--verbose"
 --verbose --

real    0m0.051s
user    0m0.000s
sys     0m0.040s

#543477#10
Date:
2010-05-25 11:21:33 UTC
From:
To:
Hi!

If you run that test on an desktop machine, you will see that that the
'Getopt::Long' version is almost 5 times longer that the 'Getopt::Std'.

On my x86 system :
pim@pim-linux:/tmp/testperl$ time perl -e 'use Getopt::Long;'

real    0m0.038s
user    0m0.028s
sys     0m0.008s
pim@pim-linux:/tmp/testperl$ time perl -e 'use Getopt::Std;'

real    0m0.007s
user    0m0.004s
sys     0m0.004s

So this numbers seems normal.



This problem is not related with perl, it is related to something slow in your
architecture (system calls, context-switch, ...) so this wish should go to the
kernel or libc page...


Best regards


Marc

#543477#15
Date:
2010-11-08 08:21:57 UTC
From:
To:
Hi,

thanks for your reply to my wish. I noticed it only now when I was
going through old bug reports. Please keep
543477-submitter@bugs.debian.org in Cc so that the emails reach me.

I think it is still a valid wish to hope that Getopt::Long would be
faster. For example on a 500 MHz x86 system the same slowdown is
visible compared to shell scripts that can use /usr/bin/getopt:

lindi@pulsar:~$ time getopt -o v --long verbose -- "--verbose"
 --verbose --

real    0m0.005s
user    0m0.004s
sys     0m0.000s
lindi@pulsar:~$ time perl -e 'use Getopt::Std;'

real    0m0.028s
user    0m0.028s
sys     0m0.000s
lindi@pulsar:~$ time perl -e 'use Getopt::Long;'

real    0m0.154s
user    0m0.152s
sys     0m0.000s

#543477#18
Date:
2010-11-08 08:21:57 UTC
From:
To:
Hi,

thanks for your reply to my wish. I noticed it only now when I was
going through old bug reports. Please keep
543477-submitter@bugs.debian.org in Cc so that the emails reach me.

I think it is still a valid wish to hope that Getopt::Long would be
faster. For example on a 500 MHz x86 system the same slowdown is
visible compared to shell scripts that can use /usr/bin/getopt:

lindi@pulsar:~$ time getopt -o v --long verbose -- "--verbose"
 --verbose --

real    0m0.005s
user    0m0.004s
sys     0m0.000s
lindi@pulsar:~$ time perl -e 'use Getopt::Std;'

real    0m0.028s
user    0m0.028s
sys     0m0.000s
lindi@pulsar:~$ time perl -e 'use Getopt::Long;'

real    0m0.154s
user    0m0.152s
sys     0m0.000s