Perl performance: for(1..200000) vs for($_=1;$_<=200000;$_++) -
for(1..200000) {...}
vs for($_=1;$_<=200000;$_++) {...}
does first 1 have create array of 200,000 items or same second?
i can definitively for
range ($lower .. $upper
) doesn't create actual temporary list in memory. it did 12 years ago, not anymore. , matter of fact, gives better performance explicit c-style for-loop (as others' benchmarks have shown), because perl able counting loop in nice, efficient internal code. shouldn't afraid use it.
Comments
Post a Comment