[Python-Dev] A new dictionary implementation (original) (raw)
Yury Selivanov yselivanov.ml at gmail.com
Wed Feb 15 22:09:17 CET 2012
- Previous message: [Python-Dev] A new dictionary implementation
- Next message: [Python-Dev] A new dictionary implementation
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello Mark,
First, I've back-ported your patch on python 3.2.2 (which was relatively easy). Almost all tests pass, and those that don't are always failing on my machine if I remember. The patch can be found here: http://goo.gl/nSzzY
Then, I compared memory footprint of one of our applications (300,000 LOC) and saw it about 6% less than on vanilla python 3.2.2 (660 MB of reserved process memory compared to 702 MB; Linux Gentoo 64bit) The application is written in heavy OOP style (for instance, ~1000 classes are generated by our ORM on the fly, and there are approximately the same amount of hand-written ones) so I hoped for a much bigger saving.
As for the patch itself I found one use-case, where python with the patch behaves differently::
class Foo: def init(self, msg): self.msg = msg
f = Foo('123')
class _str(str): pass
print(f.msg) print(getattr(f, _str('msg')))
The above snippet works perfectly on vanilla py3.2, but fails on the patched
one (even on 3.3 compiled from your 'cpython_new_dict' branch) I'm not sure
that it's a valid code, though. If not, then we need to fix some python
internals to add exact type check in 'getattr', in the 'operator.getattr', etc.
And if it is - your patch needs to be fixed. In any case, I propose to add
the above code to the python test-suite, with either expecting a result or an
exception.
Cheers, Yury
On 2012-02-15, at 12:58 PM, Mark Shannon wrote:
Any opinions on my new dictionary implementation?
I'm happy to take silence on the PEP as tacit approval, but the code definitely needs reviewing. Issue: http://bugs.python.org/issue13903 PEP: https://bitbucket.org/markshannon/cpythonnewdict/src/6c4d5d9dfc6d/pep-new-dict.txt Repository https://bitbucket.org/markshannon/cpythonnewdict Cheers, Mark.
Python-Dev mailing list Python-Dev at python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/yselivanov.ml%40gmail.com
- Previous message: [Python-Dev] A new dictionary implementation
- Next message: [Python-Dev] A new dictionary implementation
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]