[issue46705] Memory optimization for set.issubset

2022-02-10 Thread Jack Nguyen
Change by Jack Nguyen : -- keywords: +patch pull_requests: +29432 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31267 ___ Python tracker <https://bugs.python.org/issu

[issue46705] Memory optimization for set.issubset

2022-02-10 Thread Jack Nguyen
Jack Nguyen added the comment: As you say, which implementation performs better likely depends on the nature of the sets. I would suspect that using set.difference won't be substantially faster than using set.intersection in the best case, but it would be much slower if len(self) is much

[issue46705] Memory optimization for set.issubset

2022-02-09 Thread Jack Nguyen
New submission from Jack Nguyen : I noticed that the set.issubset cpython implementation casts its iterable argument to a set. In some cases, casting the whole iterable to a set is unnecessary (see https://bugs.python.org/issue18032). Although the latter suggestion is to perform early