<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > If you keep adding elements to a CPython dict/set, it periodically > rebuilds itself. So maybe dict.reserve(n) and a set.reserve(n) methods > may help, reserving enough (empty) memory for about n *distinct* keys > the programmer wants to add to the dict/set in a short future. I have > seen that the the C API of the dicts doesn't allow this, and I don't > know if this can be implemented modifying the dicts a bit. Do you think > this may be useful?
Ideas for user-controlled 'performance tuning' have been proposed on the development list. GVR has rejected such as more trouble than they are worth. Instead, effort has gone into making the implementation as good as he and others know how. Since you are writing extensions, you can create a built-in subclass of dict to experiment with. I presume the 2.5 default dict should be a model. Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list