tuning memory and time usage (was: Re: How to use a 5 or 6 bit integer in Python?)

Derrick 'dman' Hudson dman at dman13.dyndns.org
Fri Dec 19 13:33:13 EST 2003


Glen :

On Fri, 19 Dec 2003 14:30:23 +1100, Glen Wheeler wrote:

> I've read up on Numarray and the array module in the docs, but
> didn't see how I could adapt my current program to use these modules
> because of how my data is currently organised.

You may need to reorganize the data in order to save space!

>  I have one constantly changing dict with many millions of keys
> (tuples of ints) which in turn associates itself with a tuple of ints
> and two more dicts.

If you state the actual task and computation you are performing then 
people can suggest alternate data structures and algorithms.  Simply 
describing your current data structure leaves people shooting in the
dark trying to suggest alternate ways of storing the data.

Usually time and space (memory) are mutually exclusive tradeoffs --
less computation requires more storage, less storage requires more
computation.  However, there are cases where poor choice in data
structure and/or algorithm can allow a restructuring to improve both
speed and memory use.

In order to construct and evaluate data structure and algorithm
suitability a a concrete understanding of what task needs to be
performed by the program and what sort of data will be handled is
essential.

Presently you, Glen, are the only one with this knowledge of the task
and problem space.  Share that knowledge with the group and the group
will then be capable of better assisting you.

-D

-- 
A mouse is a device used to point at the xterm you want to type in.
  --Kim Alm, a.s.r
 
www: http://dman13.dyndns.org/~dman/            jabber: dman at dman13.dyndns.org




More information about the Python-list mailing list