Re: 2.4 Official -- memory stuff

new topic     » goto parent     » topic index » view thread      » older message » newer message

----- Original Message ----- 
From: "Matt Lewis" <matthewwalkerlewis at yahoo.com>
To: "EUforum" <EUforum at topica.com>
Subject: Re: 2.4 Official -- memory stuff


> 
> 
> --- Robert Craig <rds at RapidEuphoria.com> wrote:
> 
> <snip>
> 
> >     - create sequences at their final size, rather than
> >       "growing them" with append or concatenation
> 
> Or, you can compromise.  I often do this.  Grow the sequence by concatenating
> in chunks (of 100, 1000, or whatever makes sense for your purposes, or based
> on
> some trial and error to figure out an optimal size).  Use an index variable,
> and another that tracks the length of the sequence, and whenever index=max,
> add
> another chunk.  It's a really nice way to get the benefits of preallocation
> without wasting too much memory.
> 

This technique is used in win32lib. In addition to reuse of elements rather than
removing them.

-- 
Derek

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu