Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • Very similar to stackoverflow.com/questions/311775/… Commented Aug 19, 2009 at 9:13
  • Can you let us know the source / format of your keys, so we can improve the anwsers ? Commented Aug 19, 2009 at 9:39
  • At the end I learn that my performance problem was NOT coming from dict initialization. Using slots solved the problems, see: stackoverflow.com/questions/1336791/… Commented Jun 29, 2011 at 12:50
  • u should use a database and pull data from the db into a cache as needed Commented May 19, 2021 at 17:45
  • The memory consumption would depend on the objects themselves being stored (keys and values), not just the dict structure itself. Frequent rehashing wouldn't generally matter to the final memory consumption because when the dict resizes, the old table is garbage-collected. But if deletions occur, it's possible to end up with a dict using a much larger hash table than necessary. Commented May 3, 2024 at 4:35