... | ... | @@ -22,10 +22,12 @@ New style classes are faster than old style classes. Both are much faster than c |
|
|
|
|
|
The simpler your calls are the better. Passing normal arguments should not pose big performance hit, while always passing a very general {{{*args}}} and {{{**kwargs}}} might. The actual depth of the call stack does not matter that much, since a lot of it might end up being inlined and generating no extra code at all.
|
|
|
|
|
|
== Frame introspection ==
|
|
|
=== Frame introspection ===
|
|
|
|
|
|
{{{sys._getframe()}}}, {{{sys.exc_info()}}} work, but they give performance penalty that can be huge, by disabling the JIT. Use only for specialized use cases (like a debugger) where performance does not matter.
|
|
|
|
|
|
One unobvious usecase where this is used is the logging module. Don't use logging module if you want things to be fast.
|
|
|
|
|
|
== Things that are known to be slow, but shouldn't be ==
|
|
|
|
|
|
=== Generators ===
|
... | ... | |