#test.pl
use Getopt::Long;
Getopt::Long::Configure ("bundling");
GetOptions ( 'TestB|B|b' => \$testb ,
'TestA|A|a' => \$testa, );这就是我的情况--我可以把perl test.pl -Ba赶走
所以我使用Getopt::Long::Configure ("bundling");
正因为如此,我的程序一开始就变慢了,即使我试图用options perl test.pl来执行
有什么最好的方法来解决这个问题吗?
基准测试结果:
with Getopt::Long::Configure ("bundling");
real 0m6.101s
user 0m2.040s
sys 0m0.260s
Without Getopt::Long::Configure ("bundling");
real 0m3.019s
user 0m2.020s
sys 0m0.200s发布于 2010-08-27 23:39:42
虽然bundling明显减慢了初始处理的速度(因为您现在必须解析参数字符串以获得不同的子字符串组合),但是对于一个空的脚本,您似乎最多需要4%的系统时间和1%的用户时间来增加。与实际运行脚本的成本相比,这不应该是非常重要的。我承认我不确定实时变化-它们似乎没有太大的相关性-这可能是由于一些其他因素?
https://stackoverflow.com/questions/3585680
复制相似问题