bearophileHUGS
2008-12-31 08:52:40 UTC
above sim is floating type.
s.append is totally coducted 60,494,500 times.
but this code raise MemoryError.
My computer has 4G RAM.
i think it's enough. but it doesn't...
This requires about 477 MB to me.s.append is totally coducted 60,494,500 times.
but this code raise MemoryError.
My computer has 4G RAM.
i think it's enough. but it doesn't...
from array import array
a = array("d", [0.0]) * 60494500
a = array("d", [0.0]) * 60494500
Note that I have not used "append" that slows down code a lot and
wastes memory, that's what I mean with "clean".
If you really need the (i,j) part too (and you may not need it), then
you can create two more "parallel arrays". Also a numpy array may be
better for such large amount of data.
Bye,
bearophile