[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Python, Pygame and Performance



On May 21, 2004, at 8:48 PM, Jacob Schwartz wrote:

Now here is my dilemma, whenever I talk about writing code in python (especially game related things) people always seem to come back with the same response 'its too slow!' ... or laugh off its feasibility.
Python is slow, as far as execution speed goes, but it's not often "too slow".

I know that python is not an ideal language to write a full fledged game in (it is more of a glue language after all), but lately I have been spending a lot of time on a mini game project and the results have been impressive.
It is an ideal language to write most software in, IM(NS)HO. At least compared to the other languages readily available.

I have written similar programs previously in C++, using DirectX (via my own low level wrappers) and the performance of that was at most - only slighter better then using pygame.
pygame is mostly not written in Python anyways. That's the point really. Whenever you want or need speed, you can easily drop down to C, C++, etc.

- But I didn't have the safety of python, the clean list semantics, and rapid pace of development on my side. All major advantages that come from using pygame.
Exactly. These aren't pygame's benefits really, pygame only gives you a loose wrapper on top of SDL.. which you may or may not even use in a commercial quality game. The people who want performance scoff at SDL's software rendering and end up using OpenGL for all of their drawing anyways, but they may still use pygame for setting up the window and handling user input in a cross-platform way, which pygame/sdl does a good job of.

I don't believe I'm alone in noticing this illogical dislike for python/pygame.
Has anyone else experienced this?
Yes, until they've seen how fast I can do things with Python. Do you need peer approval to write software? I didn't think so :)

Any tips on what to do about it (besides hitting the nay-sayer with a stick)?
Write software that works in Python and prove them wrong. For most people, Java is still slow, even though in most cases a good JVM with JIT can beat out naive C hands down. Python is slow (to execute) any way you slice it, with a plain jane CPython VM anyways, but it's often more than enough to do the job on modern hardware.

-bob

Attachment: smime.p7s
Description: application/pkcs7-signature