|
|
|
A long time ago there was http://
bytecodehacks.sourceforge...cks.inline.html
jml |
06/02/07 - 3:08 am | #
|
|
One of the complaints about C++ inlining is that it's done in the wrong place. It makes more sense to decide at the call site than the definition site, or so they say.
Aaron Bentley |
06/02/07 - 3:30 pm | #
|
|
I think in Python the decision about inlining a function would have to be made in the place where the function is used. Besides, the possible scope of inlining would also be limited:
- no functions imported from other modules (what if we distribute a .pyc and the imported module changes?),
- no class methods (what happens if we override the inlined function in a derived class?).
That basically leaves us to module-level functions and functions defined in the local scope.
I would suggest a decorator called __inline__.
Other optimizations could include for-loop unrolling for short, fixed iterators (fixed range or literal tuple with fixed values).
AdSR |
06/02/07 - 11:37 pm | #
|
|
|
Commenting by HaloScan
|