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

Re: [pygame] pygame slowness



Personally, what I do on this list is done because I like doing it. I could careless if you make a profit. If you really do make some cash just donate to some open source project to support those who supported you. If you turn into a Gates then please give each person on the list at least one mill. :-)

I have not seen your code but I bet you have done something dumb (we all do more than we like to admit) and that is the reason for the speed problem. I remember once writing some C code to render a 3d 180 sided sphere. It ran slow as heck until I saw that I was drawing each triangle 6 time per redraw. I have rarely found big speed problems to be due to python or the style you must use. Mostly it is due to bad code.

In some ways I disagree with Randy Kaelber statement about not optimizing until the end. If it is just hacks for speed I agree but if it is poor code implementation then I disagree.

If you are making a mistake then find it. It could be that you are making the same mistake throughout all of your program(s). If we are just talking about unrolling loops then wait until it is perfect and then make the changes that turn good code into fast unreadable code. So if you are a perfect coder then Randy is right but if you are a learner then I think you should find your mistake now before it becomes a nightmare woven into your whole program. I often find that good fast code is easier to read than poor slow code.

Also if you know the function that is casing the problem then post it here. If it is a book of code then give us a URL please. I love to learn by helping others and seeing the answers of the python code gurus of this list.

DEK