|
|
|
|
|
by skywalk
4888 days ago
|
|
If you were planning to write a high performance game using python, most likely you wouldn't be using the vanilla cpython interpreter, but instead using cython (http://cython.org/) to write extensions in essentially C for all your high performance code. I think it's important to remember one of the core tenants of python is to first write in python, then optimize the bits where necessary in C by moving those calls into an extension - by using cython you get to move to C like speeds by just annotating your existing python code. Also - I think a fairly more common approach to using python in game development is to write the core in C++, then call out to python for scriptability purposes (e.g. configuring characters/levels) - rarely would one write a full game in python unless extensions were heavily used, for the reasons quoted above. |
|
a) allocating more than 160k objects
b) creating more than 22k numpy arrays
c) entering a with context more than 3700 times
d) doing a single for loop of over a million elements
can save you time from the get go. I am not suggesting that you cant write fast interactive code in Python, I am saying you wont write fast code by accident.