in reply to Re: perl process slower and slower when loop number increase
in thread perl process slower and slower when loop number increase
$ time perl -e '' real 0m0.003s user 0m0.000s sys 0m0.000s $ time php -r '' real 0m0.023s user 0m0.020s sys 0m0.000s
perl always have faster startup time
but if using $i = 100000000 where perl 7secs vs PHP 1.6secs, then the problem is not startup time
the "problem" is on perl loop, or there limit of the loop number that perl "want" to handle, thats why, I try to ask how to set the loop limit. (maybe system limit or some ENV)
note: this varian loop have same result $ time perl -e 'for($i=0;$i<=1000;$i++){for($j=0;$j<=1000;$j++){for($k +=0;$k<=100;$k++){}}}' real 0m7.867s user 0m7.860s sys 0m0.000s $ time php -r 'for($i=0;$i<=1000;$i++){for($j=0;$j<=1000;$j++){for($k= +0;$k<=100;$k++){}}}' real 0m1.717s user 0m1.712s sys 0m0.000s
in my vps, seem the limit is about 100k, beyond this, perl start slowing
note: if we not include startup time at above code, at 100k PHP and Perl have almost similiar performance $ time perl -e 'for($i=0;$i<=100000;$i++){}' real 0m0.010s user 0m0.008s sys 0m0.000s $ time php -r 'for($i=0;$i<=100000;$i++){}' real 0m0.030s user 0m0.016s sys 0m0.012s
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: perl process slower and slower when loop number increase
by Dallaylaen (Chaplain) on Jan 22, 2018 at 15:59 UTC |