classification
Title: ceval.c: reintroduce fast-path for list[index] in BINARY_SUBSCR
Type: performance Stage:
Components: Versions: Python 3.6
process
Status: closed Resolution: duplicate
Dependencies: Superseder: ceval: Optimize list[int] (subscript) operation similarly to CPython 2.7
View: 26280
Assigned To: Nosy List: rhettinger, vstinner, yselivanov
Priority: normal Keywords: patch

Created on 2016-02-06 01:40 by vstinner, last changed 2018-10-13 19:47 by pablogsal. This issue is now closed.

Files
File name Uploaded Description Edit
binary_subscr-2.patch vstinner, 2016-02-06 01:49
Pull Requests
URL Status Linked Edit
PR 9853 closed pablogsal, 2018-10-13 19:47
Messages (4)
msg259708 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-02-06 01:40
Copy of msg222985 by Raymond Hettinger from issue #21955:

"There also used to be a fast path for binary subscriptions with integer indexes.  I would like to see that performance regression fixed if it can be done cleanly."
msg259709 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2016-02-06 01:47
I think this is a duplicate of http://bugs.python.org/issue26280...
msg259710 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-02-06 01:49
(Oops, I attached the wrong patch, fixed in patch v2.)

Quick & dirty micro-benchmark:

Original:

$ ./python -m timeit -s 'lst=list("hello")' 'lst[2]'
10000000 loops, best of 3: 0.0261 usec per loop

Patched:

$ ./python -m timeit -s 'lst=list("hello")' 'lst[2]'
10000000 loops, best of 3: 0.0186 usec per loop
msg259716 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-02-06 02:26
> I think this is a duplicate of http://bugs.python.org/issue26280...

Oh, I missed this one. I didn't understand "[]" in the title. I didn't understand the purpose of optimizing BUILD_LIST :-D
History
Date User Action Args
2018-10-13 19:47:51pablogsalsetpull_requests: + pull_request9223
2016-02-06 02:26:07vstinnersetstatus: open -> closed
superseder: ceval: Optimize list[int] (subscript) operation similarly to CPython 2.7
resolution: duplicate
messages: + msg259716
2016-02-06 01:49:19vstinnersetfiles: - binary_subscr.patch
2016-02-06 01:49:13vstinnersetfiles: + binary_subscr-2.patch

messages: + msg259710
2016-02-06 01:47:29yselivanovsetmessages: + msg259709
2016-02-06 01:43:55vstinnersetfiles: + binary_subscr.patch
keywords: + patch
2016-02-06 01:40:39vstinnercreate