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 serhiy.storchaka
Recipients Dennis Sweeney, lukasz.langa, rhettinger, serhiy.storchaka
Date 2021-08-29.12:52:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1630241569.07.0.951548549318.issue45026@roundup.psfhosted.org>
In-reply-to
Content
Microbenchmarks show some speed up:

Iterating large range:

$ ./python -m timeit -s 'r = range(0, 10**20, 3**35)' 'list(r)'
Before: 2000 loops, best of 5: 199 usec per loop
After:  2000 loops, best of 5: 113 usec per loop

Unpickling:

$ ./python -m timeit -s 'from pickle import dumps, loads; p = dumps([iter(range(i)) for i in range(1000)])' 'loads(p)'
Before: 500 loops, best of 5: 476 usec per loop
After:  500 loops, best of 5: 363 usec per loop

I did not observe any difference in iterating small ranges and pickling.

Smaller size in memory, smaller pickles.
History
Date User Action Args
2021-08-29 12:52:49serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger, lukasz.langa, Dennis Sweeney
2021-08-29 12:52:49serhiy.storchakasetmessageid: <1630241569.07.0.951548549318.issue45026@roundup.psfhosted.org>
2021-08-29 12:52:49serhiy.storchakalinkissue45026 messages
2021-08-29 12:52:48serhiy.storchakacreate