Serhiy Storchaka added the comment:
In C implementation no need to create set object seen. More efficient way is to
use bit array.
Here is a patch that uses this approach.
./python -m timeit -s s1 = set(range(1000)) s1.issubset(range(1000))
Unpatched : 1 loops, best of 3: 115 usec per
Bruno Cauet added the comment:
Serhiy, that sounds good but I think that you have forgotten to attach the
mentioned patch.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18032
___
Serhiy Storchaka added the comment:
Oh, sorry. Here is it.
--
Added file: http://bugs.python.org/file39516/set_issubset_bitarray.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18032
___
Raymond Hettinger added the comment:
Personally I don't sure that this optimization is worth to apply.
I concur. Closing as not worth it :-)
--
resolution: - rejected
status: open - closed
___
Python tracker rep...@bugs.python.org
Serhiy Storchaka added the comment:
Personally I don't sure that this optimization is worth to apply. Its cost is
high and optimized case is not common. This is rather an experiment, how large
can be maximal effect of the optimization.
--
___
Bruno Cauet added the comment:
Here is an updated patch based on Dustin's work with Josh's comments. I also
added a test which takes forever on an unpatched python interpreter.
Since it's a performance issue, I've benchmarked the results. They don't change
for the most part (argument is a set
Josh Rosenberg added the comment:
Patch needs some work. See comments on patch.
--
nosy: +josh.rosenberg
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18032
___
Changes by Raymond Hettinger raymond.hettin...@gmail.com:
--
title: set methods should specify whether they consume iterators lazily -
Optimization for set/frozenset.issubset()
___
Python tracker rep...@bugs.python.org