[Python-Dev] Dictionary tuning (original) (raw)
Delaney, Timothy C (Timothy) tdelaney@avaya.com
Tue, 29 Apr 2003 17:25:50 +1000
- Previous message: [Python-Dev] Thoughts on -O
- Next message: [Python-Dev] Dictionary tuning
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: Tim Peters [mailto:tim.one@comcast.net] =20 [Delaney, Timothy C] > That's what I was getting at. I know that (for example) most > classes I create have less that 16 entries in their dict. > With this change, each class instance would take (approx) twice > as much memory for its dict. I suspect that class instance > dict is the most common dictionary I use. =20 Do they have fewer then 6 entries? Dicts with 5 or fewer=20 entries don't change size at all (an "empty dict" comes with room for 5 entries).
No hard and fast data here. That would require grovelling through code = ;) I was making an quick estimate.
Off the top of my head, most classes I create have ...
init 3-5 other methods 3-5 instance attributes
Hmm - that would only be 3-5 instance dict entries, with 4-6 class dict entries, correct?
I was forgetting that methods are put into the instance dict.
Bah - it's too late. It's the end of the day, and I've barely managed to get 2 hours real work done.
Tim Delaney
- Previous message: [Python-Dev] Thoughts on -O
- Next message: [Python-Dev] Dictionary tuning
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]