|
|
|
|
|
by Erwin
4932 days ago
|
|
Depends on your application. Ideally you want to change your code so as much computation as possible can happen in pure-C code and pure-C data types (using Cython). If you have a big class tree with many callbacks and work spread over hundreds of method, that can be difficult. Before you go that far, I'd recommend making sure you know all the Python gotchas (for example, maybe you have some inner loop that does for x in range(100000) all the time), that you algorithms are in order. Sometimes even silly microoptimization can make a difference if a small function is a significant amount of your runtime. Using multiple processes with e.g. the multiprocessing module can be an option too. Depending on what data types you operate on, numpy (and now this new thing) can do some amazing things. PS: check things like http://packages.python.org/line_profiler/ beyond the ordinary profiling. |
|