(original) (raw)
Thanks you for supporting.
BTW, my patch doesn't include OrderedDict speedup. (I'll try it when compact dict is merged.)
In case of Python 3, OrderedDict.move\_to\_end(key, last=False) can append item at front.
So implementing OrderedDict based on compact dict is not so easy as OrderedDict = dict.
My idea is using compact\_array (described in PyPy blog) as ring, not fixed capacity array.
It means one of these two:
a. dict has one additional word and support ring internally.
b. OrderedDict reimplements many APIs (iterating, resizing, etc...) to support ring.
I like (a) because it's easier to implement and maintain.
But I don't know it can be in time for Python 3.6 beta.
On Thu, Aug 11, 2016 at 12:06 AM Maciej Fijalkowski <fijall@gmail.com> wrote:
Hello everyone.
I did do only a cursory look on that one, but I would like to
reiterate that this gives huge benefits in general and we measured
nice speedups on pypy (where all the dicts are ordered forever):
\* you can essentially kill OrderedDict or make it almost OrderedDict =
dict (in pypy it's a simple dict subclass that has one or two extra
things that OrderedDict has in the API)
\* there are nice speedups
\* the C version of OrderedDict can be killed
\* it saves memory, on 64bit by quite a bit (not everyone stores more
than 4bln items in a dictionary)
\* it solves the problem of tests relying on order in dictionaries
In short, it has no downsides
On Tue, Aug 9, 2016 at 3:12 PM, INADA Naoki <songofacandy@gmail.com> wrote:
\> Hi, devs.
\>
\> I've implemented compact and ordered dictionary \[1\], which PyPy
\> implemented in 2015 \[2\].
\>
\> Since it is my first large patch, I would like to have enough time for
\> review cycle by Python 3.6 beta1.
\>
\> Could someone review it?
\>
\> \[1\] http://bugs.python.org/issue27350
\> \[2\] https://morepypy.blogspot.jp/2015/01/faster-more-memory-efficient-and-more.html
\>
\> --
\> INADA Naoki <songofacandy@gmail.com>
\> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
\> Python-Dev mailing list
\> Python-Dev@python.org
\> https://mail.python.org/mailman/listinfo/python-dev
\> Unsubscribe: https://mail.python.org/mailman/options/python-dev/fijall%40gmail.com