Converting a bidimensional list in a bidimensional array
bearophileHUGS at lycos.com
bearophileHUGS at lycos.com
Wed Jan 9 14:54:02 EST 2008
Santiago Romero:
> - Speed Performance: Do you think that changing from list to Array()
> would improve speed? I'm going to do lots of tilemap[y][x] checks (I
> mean, player jumping around the screen, checking if it's falling over
> a non-zero tile, and so).
First of all: if you have enough memory to use a python list, then I
suggest you to use a list.
That said, often the best way to know the speed is to write a little
testing code.
Often python lists are faster than array.array (maybe because python
lists actually contain pyobjects).
If you want an array.array to be faster than a list you can use Psyco.
Bye,
bearophile
More information about the Python-list
mailing list