Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45026>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to