Performance comment (oddity with set.update())

Andrew Bennetts andrew at canonical.com
Wed Apr 23 06:01:07 BST 2008


Robert Collins wrote:
> On Tue, 2008-04-22 at 16:49 -0500, John Arbash Meinel wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> > 
> > I was just debugging some performance issues, and I came across something funny.
> > 
> > Specifically, calling 'set.update()' with a generator that returns nothing is
> > slower than building it into a list and then updating.
> 
> I think this is worth filing a python bug on , so that the python devs
> are aware of it.

I doubt the python devs will do much about it.  It's not a bug, precisely:
generator expressions are implemented quite differently to list comprehensions.
It's certainly well-known by python-dev that they can be slower in some
circumstances.

-Andrew.




More information about the bazaar mailing list