[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Numpy slower than Numeric



On 12/28/06, Kamilche <kamilche@xxxxxxxxxxxx> wrote:

Sure, here it is. It's a total hack using global variables, but it
works. Numeric takes 1 second, numpy takes 2.6, doing the same
operations to the same picture.

On line 30, array = pygame.surfarray.array3d(pic2).astype(numpy.int), I need to change the final ".int" to ".Int", else it won't work for me ("AttributeError: 'module' object has no attribute 'int'"). After switching, I get these results:

Downloading http://www.kamilche.com/images/pygame/elf.png
Numeric time: 0.437000 seconds
numpy time:   0.609000 seconds

If I run it 10 times in a row, the last result it this:

Numeric time: 0.453000 seconds
numpy time:   0.578000 seconds


That is, I cannot reproduce the slow behaviour on your machine. Unless it's because of the int -> Int-change, ofcourse.

--
- Rikard.