Robert Haschke added the comment: Thank you very much for further improving the code. As I understand it, the trick is to use temporary variables to minimize access time. Learned something new.
I adapted your patch to python 2.7 again. Now, in python3, the new code is even faster than the old one (sometimes) for front insertions: 36 time for 10000 insertions at front: 0.117563 opt36 time for 10000 insertions at front: 0.116014 36 time for 10000 insertions at front: 0.114282 opt36 time for 10000 insertions at front: 0.116710 old time for 5000 insertions at front: 0.044055 new time for 5000 insertions at front: 0.075433 opt27 time for 5000 insertions at front: 0.052135 old time for 5000 insertions at back: 15.241450 new time for 5000 insertions at back: 0.071004 opt27 time for 5000 insertions at back: 0.046850 I hope you can consider, the patch for python 2.7. There the performance gain is most significant. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue24424> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com