[issue23290] Faster set copying

Raymond Hettinger report at bugs.python.org
Wed May 13 00:55:52 CEST 2015


Raymond Hettinger added the comment:

Attaching a variant with several fix-ups (mostly minor):

* Changed the order of the three sections to go from most-restricted-most-optimized to the general-fall-through case.  The downside is that we test so->fill==0 twice.  The upside is that it corresponds to my way of thinking about the logic.

* Put the fill/used increments in the same order as the rest of the file.

* Loop over other_entry++ instead of using indexing.  This corresponds to my way of thinking about the entries and gives the compiler a stronger hint that it can avoid the indexing overhead.

* Removed the unnecessary dummy check from the direct_pointer_copy case.

* Switch the order of the same size and no dummies tests in the insert_clean case.

* Revise the comments to be clearer about the requirements for each case.

* Move the sometimes unnecessary hash variable assignments inside the conditional.

----------
Added file: http://bugs.python.org/file39352/set_faster_copy_6.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23290>
_______________________________________


More information about the Python-bugs-list mailing list