That's what I thought, how about a list comp though? They're sometimes
quicker. Oh of course if you only need to run it on x86 you could use psyco
to speed up that section of the code.

2009/7/15 Richard Jones <[email protected]>

>
> Using map/lambda is always going to be much slower than a for loop.
>
>
>     Richard
>
> On 16/07/2009, at 4:43 AM, rollbak wrote:
>
> >
> > I think the fastest approach using just python is to use map built-in
> > function.
> >
> > If you have the following loop:
> > eg: for s in sprites:
> >       s.update(dx,dy)
> >
> > you can re-write it like this:
> > eg: map(lambda s: s.update(dx,dy))
> >
> > regards,
> >
> > Lucas
> >
> > On Jul 14, 12:05 pm, Eric Burgess <[email protected]> wrote:
> >> Pyglet provides some great ways to reduce function-call overhead for
> >> sprites (groups and batches).  But I still find myself looping
> >> through
> >> X sprites Y times a second, where X*Y can get quite large, doing
> >> things like "x+=dx;y+=dy".  I know there are packages like SciPy that
> >> can add an entire "dx" array to an "x" array at C-speed, but I'd
> >> rather not add the dependency.
> >>
> >> Is there a "best practice" for doing this sort of thing in pure
> >> Python?
> > >
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to