En Sat, 20 Jun 2009 07:58:02 -0300, k3xji <sum...@gmail.com> escribió:
Started a project year ago with hard goals in mind : Developing a game server which can handle thousands of clients simultaneously. [...] I don't know Python at the time and only coded few simple projects with it.
And you still could write the server - that's very good (and shows your own great skills and Python ease of use...)
After profiling the code, it turns out most of the time is spent on the following: [...] 3) Redundant try-except's in all over place(Again our fault to make the system stable, we have put some debug purposed-assert like try- excepts in the main server flow.)
I don't think this should make a difference. Setting up a try/except block usually has a very small cost (if no exception is actually raised). Care to tell us more details?
Just one note about optimizing Python code: do not optimize Python code based on your assumptions, just go and test if it really runs faster. I don't want to go to details of this hint, but believe me making Python code optimized may be very very tricky.
Yes, specially if you came from a statically typed language; what looks "innocent" may have a significant cost (e.g. resolving obj.name), and what looks complicated may be fairly fast (e.g. a list comprehension).
It is then I decided to write up here this as a success story, as I am very newcomer to Python but come up with a nearly commercial product in a very short period of time and I don't think this is about my personal characteristics and intelligence or so:), as I am old enough to know/meet that there are much much more brilliant people than I am and they also have similar experiences with Python.
Thanks for sharing your experience!
So, one last note: every software project goes same tasks as above often much much more officially and carefully, I would suggest managers to see that just do not listen to the ordinary brain-washes. Python is a great choice for easy developing, easy debugging, easy maintaining and most importantly very very time-friendly. Of course there will be tasks .n which Python is suitable, but hey, if it Python is in the list, take it seriously.
Nice summary! -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list