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 pablogsal
Recipients Aaron Hall, anthony shaw, methane, ncoghlan, pablogsal, ronaldoussoren, serhiy.storchaka
Date 2019-04-08.11:34:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1554723279.24.0.450551464349.issue36551@roundup.psfhosted.org>
In-reply-to
Content
This patch makes it slow for small iterators:

Perf program:

import perf

runner = perf.Runner()
runner.timeit("list_comp",
               stmt="[x for x in range(10)]",
               setup="")


Current master:
❯ ./python.exe ../check.py
.....................
list_comp: Mean +- std dev: 3.97 us +- 0.15 us

PR 12718:
❯ ./python.exe ../check.py
.....................
list_comp: Mean +- std dev: 4.57 us +- 0.17 us

The overhead is very likely due to calling __length_hint__
History
Date User Action Args
2019-04-08 11:34:39pablogsalsetrecipients: + pablogsal, ronaldoussoren, ncoghlan, methane, serhiy.storchaka, Aaron Hall, anthony shaw
2019-04-08 11:34:39pablogsalsetmessageid: <1554723279.24.0.450551464349.issue36551@roundup.psfhosted.org>
2019-04-08 11:34:39pablogsallinkissue36551 messages
2019-04-08 11:34:39pablogsalcreate