Mark Dickinson <[EMAIL PROTECTED]> wrote:

> On Sep 2, 12:55 pm, [EMAIL PROTECTED] (Alex Martelli) wrote:
> > Mark Dickinson <[EMAIL PROTECTED]> wrote:
> > > Well, for one thing, you're creating half a million xrange objects in
> > > the course of the search.  All the C code has
> > > to do is increment a few integers.
> >
> > I don't think the creation of xrange objects is a meaningful part of
> > Python's execution time here.  Consider:
> > [...]
> 
> Agreed---I just came to the same conclusion after doing some tests.
> So maybe it's the billion or so integer objects being created that
> dominate the running time?  (Not sure how many integer objects
> actually are created here: doesn't Python cache *some* small
> integers?)

Yep, some, say -5 to 100 or thereabouts; it also caches on a free-list
all the "empty" integer-objects it ever has (rather than returning the
memory for the system), so I don't think there's much optimization to be
had on that score either.


Alex
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to