[New-bugs-announce] [issue39521] reversed(mylist) much slower on Python 3.8.1 32-bit for Windows
Stefan Pochmann
report at bugs.python.org
Sat Feb 1 16:42:09 EST 2020
New submission from Stefan Pochmann <stefan.pochmann at gmail.com>:
Somehow `reversed` became much slower than `iter` on lists:
List with 1,000 elements:
> python -m timeit -s "a = list(range(1000))" "list(iter(a))"
50000 loops, best of 5: 5.73 usec per loop
> python -m timeit -s "a = list(range(1000))" "list(reversed(a))"
20000 loops, best of 5: 14.2 usec per loop
List with 1,000,000 elements:
> python -m timeit -s "a = list(range(250)) * 4000" "list(iter(a))"
50 loops, best of 5: 7.08 msec per loop
> python -m timeit -s "a = list(range(250)) * 4000" "list(reversed(a))"
20 loops, best of 5: 15.5 msec per loop
On another machine I tried ten different Python versions and found out it's only version 3.8.1 and only the 32-bit version:
32-bit 64-bit
CPython iter reversed iter reversed
3.5.4 19.8 19.9 22.4 22.7
3.6.8 19.8 19.9 22.3 22.6
3.7.6 19.9 19.9 22.3 22.5
3.8.1 19.8 24.9 22.4 22.6
Another time with 3.8.0 instead of 3.8.1:
32-bit 64-bit
CPython iter reversed iter reversed
3.5.4 19.5 19.6 21.9 22.2
3.6.8 19.5 19.7 21.8 22.1
3.7.6 19.5 19.6 21.7 22.0
3.8.0 19.4 24.5 21.7 22.1
I used the "Stable Releases" "executable installer"s from here:
https://www.python.org/downloads/windows/
More details here: https://stackoverflow.com/q/60005302/12671057
----------
components: Build
messages: 361195
nosy: Stefan Pochmann
priority: normal
severity: normal
status: open
title: reversed(mylist) much slower on Python 3.8.1 32-bit for Windows
type: performance
versions: Python 3.8
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39521>
_______________________________________
More information about the New-bugs-announce
mailing list