Speeding Up Python

后端 未结 18 1147
无人及你
无人及你 2020-12-02 04:55

This is really two questions, but they are so similar, and to keep it simple, I figured I\'d just roll them together:

  • Firstly: Given an est

18条回答
  •  暖寄归人
    2020-12-02 05:42

    First thing that comes to mind: psyco. It runs only on x86, for the time being.

    Then, constant binding. That is, make all global references (and global.attr, global.attr.attr…) be local names inside of functions and methods. This isn't always successful, but in general it works. It can be done by hand, but obviously is tedious.

    You said apart from in-code optimization, so I won't delve into this, but keep your mind open for typical mistakes (for i in range(10000000) comes to mind) that people do.

提交回复
热议问题