[issue23269] Tighten-up search loops in sets

2015-01-26 Thread Raymond Hettinger
Raymond Hettinger added the comment: Applied Sirhiy's version of the patch but may switch to the j=0 version later. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23269

[issue23269] Tighten-up search loops in sets

2015-01-26 Thread Roundup Robot
Roundup Robot added the comment: New changeset 0b2a3d764e63 by Raymond Hettinger in branch 'default': Issue #23269: Tighten search_loop in set_insert_clean() https://hg.python.org/cpython/rev/0b2a3d764e63 -- nosy: +python-dev ___ Python tracker

[issue23269] Tighten-up search loops in sets

2015-01-25 Thread Raymond Hettinger
Raymond Hettinger added the comment: May be worth to move this test outside of the loop as in the set_lookup function. The loop used to be this way but testing showed no benefit, so a while back I recombined it back to a j=0 start point and the code looked much nicer. I don't really want

[issue23269] Tighten-up search loops in sets

2015-01-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I have no strong preferences. This code is used very rarely and I have no any example which exposes performance differences. But how large the benefit of your patch? It doesn't make the C code more clean. -- ___

[issue23269] Tighten-up search loops in sets

2015-01-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: What timing results? There is large chance that first tested entry is empty. May be worth to move this test outside of the loop as in the set_lookup function. i = mask; may be moved to the start of the loop. -- Added file:

[issue23269] Tighten-up search loops in sets

2015-01-25 Thread Raymond Hettinger
Raymond Hettinger added the comment: Reopening this with a better patch that nicely tightens the inner-loop without an algorithmic change or any downside. Currently, the entry computation adds a constant (i+j), masks it (mask) to wrap on overflow, scales it to a table index ( 4), and then

[issue23269] Tighten-up search loops in sets

2015-01-20 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- resolution: - rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23269 ___

[issue23269] Tighten-up search loops in sets

2015-01-19 Thread Raymond Hettinger
New submission from Raymond Hettinger: First draft of patch to switch from a table[(i+j)mask] style of entry calculation to an entry++ style. The entry computation simplifies from add/shl4/and/lea to a single add16. To do this, the linear probes are limited to the length of table rather

[issue23269] Tighten-up search loops in sets

2015-01-19 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +pitrou, serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23269 ___ ___

[issue23269] Tighten-up search loops in sets

2015-01-19 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: Added file: http://bugs.python.org/file3/measure_build_set.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23269 ___

[issue23269] Tighten-up search loops in sets

2015-01-19 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: Added file: http://bugs.python.org/file37776/limit2.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23269 ___

[issue23269] Tighten-up search loops in sets

2015-01-19 Thread Raymond Hettinger
Raymond Hettinger added the comment: Patch timings give inconsistent results. GCC-4.9 generates faster code and CLang generates slower code :-( -- Added file: http://bugs.python.org/file37775/timings.txt ___ Python tracker rep...@bugs.python.org

[issue23269] Tighten-up search loops in sets

2015-01-19 Thread Antoine Pitrou
Antoine Pitrou added the comment: Either way the improvement doesn't look terrific, so I would suggest not to bother with this. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23269 ___