INADA Naoki added the comment:

> I would side with Inada in thinking they both give the same amortized 
> complexity, but beyond that, benchmarks are the real answer.  There is little 
> value in keeping the current implementation of OrderedDict *if* benchmarks 
> show that it is rarely faster.

As I wrote in here:
https://bugs.python.org/issue31265#msg300757

PyPy-like ODict implementation is:

* 1000 less lines of code
* 50% less memory usage
* 15% faster creation
* 100% (2x) faster iteration
* 20% slower move_to_end
* 40% slower comparison

Since current implementation is still draft, there are some
potential optimization.

* Optimize over allocation ratio for move_to_end.  I have not tried to adjust 
it for nice balance between speed and space.
* I used temporary list to comparing keys safely.  But it can be avoided like 
normal iteration.

I'll try them in this or next week.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue31265>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to