Huge Dicts and perfomance

Lucio Torre lucio at
Thu Dec 20 17:26:27 CET 2001


I am making an application where i want to store links betwen nodes. So 
i have a dictionary where i store the objects.

dict[0][objectname] = object

the [0] is because i to signify a link betwen obj-a and obj-b, i do:

dict[1][(obj-a, obj-b)] = obj(a, b)

and so on, to six levels deep.

and i also store links betwen dict[x][y] and other nodes (the stored 
object has those links)

and i want to say for example, if i have a and b, what other nodes 
usually come togheter? so i follow the links and find the root nodes (z, 
x) and the groups (a, z) and (s, x).

the main problem of course is that doing it this way, performance sucks. 
I took me nothing to code it, but it takes to much to run (more than 
coding). So, any ideas on how to achieve my goal in a better (faster) way?



More information about the Python-list mailing list