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.

classification
Title: Remove bad PREDICT in ceval.c
Type: Stage:
Components: Interpreter Core Versions: Python 2.5
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: collinwinter, nnorwitz, rhettinger
Priority: normal Keywords: patch

Created on 2006-03-04 18:52 by collinwinter, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
ceval.c.diff collinwinter, 2006-03-04 18:52 Patch to Python/ceval.c, r42830
Messages (3)
msg49652 - (view) Author: Collin Winter (collinwinter) * (Python committer) Date: 2006-03-04 18:52
The current FOR_ITER -> UNPACK_SEQUENCE prediction is
only right 6.41% of the time (212 million opcodes
analysed). This patch removes it.
msg49653 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2006-03-06 23:42
Logged In: YES 
user_id=33168

Raymond any comments?
msg49654 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2006-03-07 00:02
Logged In: YES 
user_id=80475

Collin, you are welcome to write to me directly to discuss 
the results of your dynamic analysis. I suspect your 
results are almost certainly incorrect.  The prediction 
was originally added after a detailed analysis of a great 
deal of Python code and checking the results of multiple 
pieces of benchmark code.  Please do not arbitrarily start 
removing these unless you're damned certain the original 
study was erronenous.

Also, I suspect that the given percentage does not reflect 
the conditional probability of the preceding PREDICT
(STORE_FAST).  The overwhelming majority of cases needing 
optimization involve "for x in iterable" where x is a fast 
local.  If that prediction fails, then the next most 
common case is "for x,y in iterable".  The latter is 
highly likely whenever we know the former has not 
occured.  IOW, the unpack sequence may only come up 6% of 
the time, but its conditional probability rises above 90% 
when it follows the other prediction.

Also, take some case with dynamic analysis.  It is always 
tricky because it is very difficult to find truly 
representative code and to not have a single anomalous 
case run over and over again.
History
Date User Action Args
2022-04-11 14:56:15adminsetgithub: 42980
2006-03-04 18:52:44collinwintercreate