[issue24424] xml.dom.minidom: performance issue with Node.insertBefore()
Robert Haschke
report at bugs.python.org
Sat Jun 18 11:21:46 EDT 2016
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 <report at bugs.python.org>
<http://bugs.python.org/issue24424>
_______________________________________
More information about the Python-bugs-list
mailing list