[issue2672] speed of set.update([])

Alexander Belopolsky report at bugs.python.org
Wed Apr 23 22:19:55 CEST 2008


Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:

This has nothing to do with set.update, the difference is due to the
time to setup the generator:

$ python -m timeit -s 'x = set(range(10000)); y = []' 'x.update(y)'
1000000 loops, best of 3: 0.38 usec per loop
$ python -m timeit -s 'x = set(range(10000)); y = (i for i in [])'
'x.update(y)'
1000000 loops, best of 3: 0.335 usec per loop

----------
nosy: +belopolsky

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2672>
__________________________________


More information about the Python-bugs-list mailing list