Please log in to access this page.
surfarray_profile — wiki
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