[Python-Dev] default of returning None hurts performance?
Scott Dial
scott+python-dev at scottdial.com
Tue Sep 1 09:52:51 CEST 2009
More information about the Python-Dev mailing list
Tue Sep 1 09:52:51 CEST 2009
- Previous message: [Python-Dev] default of returning None hurts performance?
- Next message: [Python-Dev] default of returning None hurts performance?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Raymond Hettinger wrote: >> I was just wondering if a bytecode for a superinstruction of the common >> sequence: >> >> 6 POP_TOP >> 7 LOAD_CONST 0 (None) >> 10 RETURN_VALUE >> >> might be worth it. > > [Collin Winter] >> I doubt it. You'd save a bit of stack manipulation, but since this >> will only appear at the end of a function, I'd be skeptical that this >> would make any macrobenchmarks (statistically) significantly faster. > > I concur with Collin. And since it appears only at the end of a function, > the optimization doesn't help inner-loops in a function (where most of > the time usually spent). > I fail to understand this crude logic. How often is the inner-loop really going to solely call C code? Any call to Python in an inner-loop is going to suffer this penalty on the order of the number of loop iterations)? -Scott -- Scott Dial scott at scottdial.com scodial at cs.indiana.edu
- Previous message: [Python-Dev] default of returning None hurts performance?
- Next message: [Python-Dev] default of returning None hurts performance?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list