Movatterモバイル変換


[0]ホーム

URL:


[Python-Dev] A new dictionary implementation

Michael Foordfuzzyman at voidspace.org.uk
Thu Feb 9 12:51:31 CET 2012


On 08/02/2012 15:16, Mark Shannon wrote:> Hi,>> Version 2 is now available.>> Version 2 makes as few changes to tunable constants as possible, and> generally does not change iteration order (so repr() is unchanged).> All tests pass (the only changes to tests are for sys.getsizeof() ).>> Repository:https://bitbucket.org/markshannon/cpython_new_dict> Issuehttp://bugs.python.org/issue13903>> Performance changes are basically zero for non-OO code.> Average -0.5% speed change on 2n3 benchamrks, a few benchmarks show> a small reduction in memory use. (see notes below)>> GCbench uses 47% less memory and is 12% faster.> 2to3, which seems to be the only "realistic" benchmark that runs on Py3,> shows no change in speed and uses 10% less memory.In your first version 2to3 used 28% less memory. Do you know why it's worse in this version?Michael>> All benchmarks and tests performed on old, slow 32bit machine> with linux.> Do please try it on your machine(s).>> If accepted, the new dict implementation will allow a useful> optimisation of the LOAD_GLOBAL (and possibly LOAD_ATTR) bytecode:> By testing to see if the (immutable) keys-tables is the expected table,> the value can accessed directly by index, rather than by name.>> Cheers,> Mark.>>> Notes:> All benchmarks fromhttp://hg.python.org/benchmarks/> using the -m flag to get memory usage data.>> I've ignored the json benchmarks which shows unstable behaviour> on my machine.> Tiny changes to the dict being serialized or to the random seed can> change the relative speed of my implementation vs CPython from -25% to> +10%.> _______________________________________________> 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/fuzzyman%40voidspace.org.uk>--http://www.voidspace.org.uk/May you do good and not evilMay you find forgiveness for yourself and forgive othersMay you share freely, never taking more than you give.-- the sqlite blessinghttp://www.sqlite.org/different.html


More information about the Python-Devmailing list

[8]ページ先頭

©2009-2025 Movatter.jp