Re: Light slices + COW

2008-05-04 Thread castironpi
On May 4, 7:49 am, David <[EMAIL PROTECTED]> wrote: > >  > D compiles to efficient machine code so Python is at a disadvantage > >  > even if you use the same syntax (see my first example). You can make > >  > the Python version faster, but beware of premature optimization. > > >  This time I don't

Re: Light slices + COW

2008-05-04 Thread David
> > D compiles to efficient machine code so Python is at a disadvantage > > even if you use the same syntax (see my first example). You can make > > the Python version faster, but beware of premature optimization. > > This time I don't agree with this "premature optimization" thing. My > origi

Re: Light slices + COW

2008-05-04 Thread bearophileHUGS
David: > What do you mean by best possible? Most efficient? Most readable? What's a good wine? It's not easy to define what's "good/best". In such context it's a complex balance of correct, short, fast and readable (and more, because you need to define a context. This context refers to Psyco too)

Re: Light slices + COW

2008-05-03 Thread David
advantage even if you use the same syntax (see my first example). You can make the Python version faster, but beware of premature optimization. > I think Python 3.0 too may enjoy a similar strategy of light slices + > COW for strings, lists and arrays (tuples and strings don't need the

Re: Light slices + COW

2008-05-03 Thread castironpi
> doesn't even create a slice object in the heap each time the outer > foreach loops. > > One problem with this strategy is that if you have a huge string, and > you keep only a little slice of it, the D garbage collector will keep > it all in memory. To avoid that problem you h

Light slices + COW

2008-05-03 Thread bearophileHUGS
nk Psyco in some situations is able to manage string slices avoiding the copy. I think Python 3.0 too may enjoy a similar strategy of light slices + COW for strings, lists and arrays (tuples and strings don't need the COW). Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list