>> Bear in mind that C, Java etc are compiled languages

AFAIK, C is compiled language, Java etc only "compile" to intermediate code, well, AFAIK (again) perl have optimizer that do like java, but no need create intermediate code file like java class

php and nodejs are not "compiled" language, but their loop process not slowing down

>> You haven't shown anything apart from perl taking a time linearly proportional the the number of times the loop is executed

in my vps box: $ time perl -e '' real 0m0.003s user 0m0.000s sys 0m0.000s $ time perl -e 'for($i=0;$i<=0;$i++){}' real 0m0.003s user 0m0.000s sys 0m0.000s $ time perl -e 'for($i=0;$i<=10;$i++){}' real 0m0.004s user 0m0.004s sys 0m0.000s $ time perl -e 'for($i=0;$i<=100;$i++){}' real 0m0.004s user 0m0.000s sys 0m0.000s $ time perl -e 'for($i=0;$i<=1000;$i++){}' real 0m0.003s user 0m0.000s sys 0m0.000s $ time perl -e 'for($i=0;$i<=10000;$i++){}' real 0m0.005s user 0m0.004s sys 0m0.000s $ time perl -e 'for($i=0;$i<=100000;$i++){}' real 0m0.015s user 0m0.012s sys 0m0.000s $ time perl -e 'for($i=0;$i<=1000000;$i++){}' real 0m0.094s user 0m0.088s sys 0m0.004s $ time perl -e 'for($i=0;$i<=10000000;$i++){}' real 0m0.731s user 0m0.724s sys 0m0.004s $ time perl -e 'for($i=0;$i<=100000000;$i++){}' real 0m7.253s user 0m7.256s sys 0m0.000s $ time perl -e 'for($i=0;$i<=1000000000;$i++){}' real 1m13.921s user 1m13.828s sys 0m0.008s

I still think there limit number between $i=100000 and $i=1000000;

but where to set it ?


In reply to Re^4: perl process slower and slower when loop number increase by Anonymous Monk
in thread perl process slower and slower when loop number increase by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.