Re: genexp performance problem?
- From: Fredrik Lundh <fredrik@xxxxxxxxxxxxxx>
- Date: Wed, 31 May 2006 08:40:25 +0200
Giovanni Bajo wrote:
I found this strange:
python -mtimeit "sum(int(L) for L in xrange(3000))"
100 loops, best of 3: 5.04 msec per loop
python -mtimeit "import itertools; sum(itertools.imap(int, xrange(3000)))"
100 loops, best of 3: 3.6 msec per loop
I thought the two constructs could achieve the same speed.
hint: how many times to the interpreter have to look up the names "int" and "L" in the two examples ?
</F>
.
- Follow-Ups:
- Re: genexp performance problem?
- From: Giovanni Bajo
- Re: genexp performance problem?
- References:
- genexp performance problem?
- From: Giovanni Bajo
- genexp performance problem?
- Prev by Date: Re: Watching serial port activity.
- Next by Date: Re: genexp performance problem?
- Previous by thread: genexp performance problem?
- Next by thread: Re: genexp performance problem?
- Index(es):