Why it is so dramatical?

holger krekel pyth at devel.trillke.net
Mon Sep 2 06:45:05 EDT 2002


Bo M. Maryniuck wrote:
> On Monday 02 September 2002 11:57, Duncan Booth wrote:
> > None of this is specific to Python, the same issues arise in almost any
> > programming language (although not always the same solutions).
> Almost... Keep in mind, that here is the range 0-0xffffff, what is quite
> bigger that 0-0xfff:
> ----------------------8<---------------------------
> #!/usr/bin/perl
> 
> $b = '';
> $data = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA';
> for $a (0..0xffffff) {
>     $b += $data;
> }

That should result in a 1.3 GIGABYTE string.  
Watching the perl-process i see that perl doesn't use more than 1MB.
So probably perl does some optimization for this in-fact meaningless code.

It's much more interesting to look at real performance limitations
instead of some theoretical pusing-the-limits loops.  

    holger




More information about the Python-list mailing list