Reducing pygame cpu-load to < 4 %

Bernardo Innocenti bernie at codewiz.org
Sun Dec 9 18:49:58 EST 2007


On 12/09/07 18:35, Roberto Fagá wrote:

> Another good option to optimize games in PyGame on XO is to reduce the
> depth of the colors on:
> window = pygame.display.set_mode((400, 225), 16)

Isn't 16bpp the default?

The X display runs at 16bpp, so using any other depth causes
useless and very expensive runtime conversions.

Application and game developers should avoid assuming a
particular screen resolution and depth.  These apparently
fixed properties are in fact subject to change in future
generations of the XO, and may already be different in
emulated environments.  Moreover, people are already porting
Sugar to different hardware than the XO, including regular
Linux distributions.

It is therefore wise to *always* query screen properties
at run-time and load/render graphics in the correct format.
Cairo makes it extremely easy.

-- 
 \___/
 |___|   Bernardo Innocenti - http://www.codewiz.org/
  \___\  One Laptop Per Child - http://www.laptop.org/




More information about the Devel mailing list