This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients lebedov, rhettinger, vstinner
Date 2014-05-14.22:18:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1400105930.13.0.182632478399.issue21507@psf.upfronthosting.co.za>
In-reply-to
Content
frozenset constructor has different implementations depending on the input type: set (or frozenset), dict or iterator. The constructor preallocates the frozenset for set and dict, but not for generic iterator and so the set may have a suboptimal size.

Attached patch set_length_hint.patch optimizes also the 3rd case using operator.length_hint (PyObject_LengthHint in C).

Since it is an optimization, I prefer to only apply it to Python 3.5 to limit the risk of regression.
History
Date User Action Args
2014-05-14 22:18:50vstinnersetrecipients: + vstinner, rhettinger, lebedov
2014-05-14 22:18:50vstinnersetmessageid: <1400105930.13.0.182632478399.issue21507@psf.upfronthosting.co.za>
2014-05-14 22:18:50vstinnerlinkissue21507 messages
2014-05-14 22:18:49vstinnercreate