[issue39521] reversed(mylist) much slower on Python 3.8.1 32-bit for Windows

2020-02-01 Thread SilentGhost


SilentGhost  added the comment:

Your 3.8.0 numbers are similar to 3.8.1

--
components: +Interpreter Core -Build
nosy: +SilentGhost, serhiy.storchaka, vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39521] reversed(mylist) much slower on Python 3.8.1 32-bit for Windows

2020-02-01 Thread Stefan Pochmann


New submission from Stefan Pochmann :

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))"
5 loops, best of 5: 5.73 usec per loop

> python -m timeit -s "a = list(range(1000))" "list(reversed(a))"
2 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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com