I wrote: > > The (only) solution I could came with for this pb is the appended patch. > It is not immediately obvious, but in practice, it seems to work fine. > (inserting a print statement after the condition, showing the dict size > and current usage helps in monitoring what's going on). > > Any other ideas on how to deal with this? Thoughts, comments? > To clarify a bit what the patch does "as is", here's a short description: The code is triggered in PyDict_DelItem only for sizes which are > MINSIZE*4, i.e. greater than 4*4 = 16. Therefore, resizing will occur for a min size of 32 items. one third 32 / 3 = 10 two thirds 32 * 2/3 = 21 one sixth 32 / 6 = 5 So the shinking will happen for a dict size of 32, of which 5 items are used (the sixth was just deleted). After the dictresize, the size will be 16, of which 5 items are used, i.e. one third. The threshold is fixed by the first condition of the patch. It could be made 64, instead of 32. This is subject to discussion... Obviously, this is most useful for bigger dicts, not for small ones. A threshold of 32 items seemed to me to be a reasonable compromise. -- Vladimir MARANGOZOV | Vladimir.Marangozov@inrialpes.fr http://sirac.inrialpes.fr/~marangoz | tel:(+33-4)76615277 fax:76615252
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4