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
Feb 7, 2016


Feb 4, 2016

Jan 30, 2016

Jan 24, 2016

Jan 23, 2016

Jan 18, 2016

Jan 5, 2016

Dec 27, 2015

Dec 12, 2015

Dec 11, 2015

Dec 7, 2015

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