how to store great array?
paulus132 at my-deja.com
paulus132 at my-deja.com
Mon Jan 29 08:56:15 EST 2001
For 2 mio Documents, I have a "Year" field (4 characters) associated
with each of them. I try to store this in Python, to report him over
other records.
It is possible ? Wich is the faster method ?
The easiest way is a dictionnary { doc_num : year } but how estimate the
necessary memory ? With old Basic's, the FREE(0) Builtin returns the
number of free memory. Is there comparable module/class/function to
survey memory use in Python ?
Another way is to construct a list doc_years = ["1934", "1942", "1897",
....], and access it with doc_years[doc_num]. Is doc_years[2000000] as
fast as doc_years[456] ?
Another way is to construct an unique string with all years
concatenated, and access it with all_years[4*doc_num:4*doc_num+4]. But I
think that 7.6 Mo length is too big ! How long can be a string ?
Thanks in advance!
Paul Perrin
Sent via Deja.com
http://www.deja.com/
More information about the Python-list
mailing list