Movatterモバイル変換
[0]ホーム
[Python-Dev] A new dictionary implementation
Mark Shannonmark at hotpy.org
Mon Feb 13 13:31:38 CET 2012
Hi All,My new dictionary implementation has been further updated in light ofvarious comments and questions.The code is here:https://bitbucket.org/markshannon/cpython_new_dictThe resizing code has been streamlined. This means that resizingby doubling does not suffer any real performance penalty versusquadrupling. Doubling uses less memory for most benchmarks (it never uses more memory).Michael Foord wrote:>> 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?>The answer is that the second version used quadrupling rather thandoubling for resizing.All tests pass.test_sys has been altered to allow for the different size of the dictionary.One test in test_pprint has been disabled. This test is broken anyway,seehttp://bugs.python.org/issue13907.In general, for the new dictionary implementation, with doubling at aresize, speed is unchanged and memory usage is reduced.On "average": ~1% slow down, ~10% reduction in memory use.Full set of benchmarks for new dict with doubling and quadrupling attached.Unfortunately the benchmarking program introduces systematic errorsfor timings, but it's the best we have at the moment.Note that the json benchmark is unstable and should be ignored.The GC benchmark might be unstable as well, I haven't experimented.The memory usage numbers seems to be more reliable.Revised PEP to follow.Cheers,Mark.-------------- next part --------------An embedded and charset-unspecified text was scrubbed...Name: new_dict_benchmarks.txtURL: <http://mail.python.org/pipermail/python-dev/attachments/20120213/a343d71f/attachment.txt>
More information about the Python-Devmailing list
[8]ページ先頭