[Python-Dev] Speeding up CPython 5-10% (original) (raw)

Yury Selivanov yselivanov.ml at gmail.com
Wed Jan 27 17:40:26 EST 2016


BTW, this optimization also makes some old optimization tricks obsolete.

  1. No need to write 'def func(len=len)'. Globals lookups will be fast.

  2. No need to save bound methods:

obj = [] obj_append = obj.append for _ in range(10**6): obj_append(something)

This hand-optimized code would only be marginally faster, because of LOAD_METHOD and how it's cached.

Yury



More information about the Python-Dev mailing list