Computer Science question (python list is slow with my cruddy algorithm )

Mr. Neutron nicktsocanos at charter.net
Fri Aug 23 07:00:03 EDT 2002


On Fri, 23 Aug 2002 05:50:26 -0400, Jirka 'Eagle' Novak wrote:
just a beginer in python.
> 
> Running multiple threads to populate the matrix could be a nice trick if
> you have a more than one CPU (assuming python wouldn't be against it
> ;-)).

That was my first discovery of a problem with Python. Only one thread can
be in the interpreter at any time. Therefore Python does not make use of
multiple CPUs.

Somebody said there is a GIL (global interpreter lock). You can somehow
release the GIL in C and have Python thread run on another CPU at the
same time.

However for a single CPU the thread problem should still work OK if you
think you have N threads generating chunks of a list and therefore it is
N times faster (in my theory of how it would work). But it seems silly to
use such a compicated thing to make an array right?!

But anyways the real problem is my understanding of the memory
requirements of the array (4GB!!!). I have not programemd in several
years so I am very rusty still.

I have thought of a new strategy for this world that does not need such a
huge array but still can be used to create big worlds with it.

See yah



More information about the Python-list mailing list