[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] converting byte image for display
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] converting byte image for display
- From: Guillaume Proux <gproux@xxxxxxxxx>
- Date: Sun, 1 Jan 2006 15:59:41 +0900
- Delivered-to: archiver@seul.org
- Delivered-to: pygame-users-outgoing@seul.org
- Delivered-to: pygame-users@seul.org
- Delivery-date: Sun, 01 Jan 2006 19:33:51 -0500
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=r0TwbboJapko2u2qLNI8e0CdPvgC4jYKsV5/ntwqKFevIO8FKbnzMJ5qMv73taAlbPenEL01KjUwnCIPIMNO256qgqSnl8OH62B3tEzG3eD6/zCcZoI9J5RNPYpWIfFk0vrPqm8qh0dtJcyx4YDOwd8wvrBN1kWhSrFzPgqbDc8=
- In-reply-to: <58cb4d1f0512311459g13fee732k54d87aa4001f866e@mail.gmail.com>
- References: <58cb4d1f0512311459g13fee732k54d87aa4001f866e@mail.gmail.com>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
Ouch!
def to_bw(rawbuffer):
retstr=''
for e in rawbuffer :
retstr = retstr + e*3
return retstr
This is a typical slow usage of string concat.
the same loop would be much quicker execute like this
bwbuffer = "".join(map(lambda x:x*3,rawbuffer))
Guillaume