pygame is
Python
Simple DirectMedia Layer
 
 
pygame.org is
Site Swing
Wiki

surfarray_profile

      
Search:  
 
 

Pygame 1.9.2 (rev 3003), Python 2.5.5, NumPy 1.4.1, Numeric 24.2

Debian squeeze

Comparison of pygame.surfarray.array_colorkey for Numeric and NumPy was done with the following program:

import pygame
import pygame.surfarray
from pygame._numericsurfarray import array_colorkey as nu_array_colorkey
from pygame._numpysurfarray import array_colorkey as np_array_colorkey
from pygame.time import get_ticks
 
pygame.init()
s = pygame.Surface((2000, 1000), 0, 24)
s.fill((255, 255, 255), pygame.Rect(500, 250, 1000, 500))
s.set_colorkey((0, 0, 0))
 
min_numpy = 1000000
min_numeric = 1000000
 
for i in range(100):
    t0 = get_ticks()
    np = np_array_colorkey(s)
    min_numpy = min(get_ticks() - t0, min_numpy)
 
    t0 = get_ticks()
    nu = nu_array_colorkey(s)
    min_numeric = min(get_ticks() - t0, min_numeric)
 
print ("NumPy: %i milliseconds\nNumeric: %i milliseconds" %
       (min_numpy, min_numeric))
 
pygame.quit()

General times recorded for a 1GHz AMD Athlon(tm) were:

NumPy: 126 milliseconds

Numeric: 52 milliseconds

spotlight

 
our projects
pygame.org welcomes all python game, art, music, sound, video and multimedia projects. If they use pygame or not.
 
recent releases
Apr 21, 2014


Apr 19, 2014

Apr 16, 2014

Apr 13, 2014

Apr 9, 2014

Mar 18, 2014


Mar 15, 2014


Mar 14, 2014

Mar 13, 2014

... more!
 
for pygame related questions, comments, and suggestions, please see help (lists, irc)