strangely, the simple push won!No need to be so surprised. In both your and my benchmark, the difference between "push", "assign" and "assignpre" is small, less than 10%. Speed rate differences as reported by Benchmark can differ drasticly not only between versions of Perl, but only if the underlaying OS differs, or the compiler used to compile Perl (even different versions of the same compiler!). That is, a benchmark can give different "winners" for the same test if the OS, Perl version or compiler differs.
Abigail
In reply to Re: array pre-allocation trick
by Abigail-II
in thread array pre-allocation trick
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |