[issue23290] Faster set copying

2015-05-13 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- resolution: later - fixed stage: patch review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23290

[issue23290] Faster set copying

2015-05-13 Thread Roundup Robot
Roundup Robot added the comment: New changeset 79c884cc9625 by Raymond Hettinger in branch 'default': Issue #23290: Optimize set_merge() for cases where the target is empty. https://hg.python.org/cpython/rev/79c884cc9625 -- nosy: +python-dev ___

[issue23290] Faster set copying

2015-05-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Except one error (the declaration after the code), the patch LGTM. It is shame to me that I left so much non-optimized code in specialized loops. The result of my microbenchmarks is the speed up 51%, 153%, 23% and 96% respectively. --

[issue23290] Faster set copying

2015-05-12 Thread Raymond Hettinger
Raymond Hettinger added the comment: I don't like the patch as-is (comment change is wrong, test in the inner-loop making the common case pay for a short-cut for the uncommon case). As I said before, the basic idea is good and I will very likely include some variant of this for Python3.5. I

[issue23290] Faster set copying

2015-05-12 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Doesn't the feature freeze start from beta 1? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23290 ___ ___

[issue23290] Faster set copying

2015-05-12 Thread Raymond Hettinger
Raymond Hettinger added the comment: Optimizations aren't new features. We can still tweak the implementation through-out the betas. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23290

[issue23290] Faster set copying

2015-05-12 Thread Raymond Hettinger
Raymond Hettinger added the comment: I looked at the patch again and it is in pretty good shape. Please hoist the conditionals out of the loop (for intelligibility and to let the compiler in-line more effectively). Also, let's remove the dump and clear variable names in favor of comments

[issue23290] Faster set copying

2015-05-12 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Here is the patch with hoisted the conditionals out of the loop. New microbenchmarking results: $ ./python -m timeit -s s = set(range(10**4)) -- frozenset(s) Unpatched: 1000 loops, best of 3: 407 usec per loop With patch #4: 1000 loops, best of 3: 325

[issue23290] Faster set copying

2015-05-12 Thread Antoine Pitrou
Antoine Pitrou added the comment: Le 12/05/2015 20:55, Raymond Hettinger a écrit : Optimizations aren't new features. We can still tweak the implementation through-out the betas. Not really. The period after the first beta is for fixing bugs, not for risking introducing new bugs.

[issue23290] Faster set copying

2015-05-12 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Could you please pay a little attention to this issue Raymond? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23290 ___

[issue23290] Faster set copying

2015-05-12 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: Added file: http://bugs.python.org/file39353/set_faster_copy_6.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23290 ___

[issue23290] Faster set copying

2015-05-12 Thread Raymond Hettinger
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

[issue23290] Faster set copying

2015-05-12 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: Removed file: http://bugs.python.org/file39352/set_faster_copy_6.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23290 ___

[issue23290] Faster set copying

2015-03-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Updated patch addresses Victor's comment. Thank you for your review Victor. Is msg234811 the result of set_faster_copy_3.patch? Yes, it is. There are tests for sets with small and large number of hash conflicts, with and without dummy objects. The patch

[issue23290] Faster set copying

2015-03-27 Thread STINNER Victor
STINNER Victor added the comment: New patch looks good to me. Great job on speedup. I didn't expect that it's still possible to enhance set. By the way, is it possible to report latest enhancement to the dict type? I don't remember if tou tried that richard? --

[issue23290] Faster set copying

2015-03-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I didn't expect that it's still possible to enhance set. Raymond made a lot of set optimizations recently. By the way, is it possible to report latest enhancement to the dict type? I don't remember if tou tried that richard? May be when Raymond port his

[issue23290] Faster set copying

2015-03-26 Thread STINNER Victor
STINNER Victor added the comment: Is msg234811 the result of set_faster_copy_3.patch? If yes, I see no reason to not apply the patch: the patch is short and looks always fast, and sometimes *much* faster. I just leaved a small comment on the review. -- nosy: +haypo

[issue23290] Faster set copying

2015-03-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Ping. The last patch doesn't add more lookkey variants, it uses existing function. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23290 ___

[issue23290] Faster set copying

2015-03-01 Thread Raymond Hettinger
Raymond Hettinger added the comment: I still intend to apply some variant of your patch. Am still looking at the options. -- priority: normal - low ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23290

[issue23290] Faster set copying

2015-01-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Actually set_find_free_slot() is not needed because there is set_insert_clean(). Results with using set_insert_clean(): $ ./python -m timeit -s s = set(range(10**4)) -- frozenset(s) Unpatched: 1000 loops, best of 3: 700 usec per loop Patched: 1000 loops,

[issue23290] Faster set copying

2015-01-25 Thread Raymond Hettinger
Raymond Hettinger added the comment: For the time being (while I working on other parts of sets), I'm holding-off an anything that adds more lookkey variants. When the neatening-up and tweaking of search routines comes to a close, I'll revisit this one because it looks like there is a some

[issue23290] Faster set copying

2015-01-22 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- assignee: - rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23290 ___ ___

[issue23290] Faster set copying

2015-01-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Here is even faster patch. When there are no dummies in source set we can just dump a table, placing entries at the same indices. $ ./python -m timeit -s s = set(range(10**4)) -- frozenset(s) Unpatched: 1000 loops, best of 3: 658 usec per loop Patched: 1000

[issue23290] Faster set copying

2015-01-21 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: Proposed patch makes faster creating new set from other set. The benefit is only few percents when there are no hash conflicts, but can be significant if there are hash duplicates. $ ./python -m timeit -s s = set(range(10**4)) -- frozenset(s) Unpatched:

[issue23290] Faster set copying

2015-01-21 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- keywords: +patch nosy: +pitrou, rhettinger Added file: http://bugs.python.org/file37807/set_faster_copy.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23290