Python speed

jcm grumble at usa.net
Fri Jul 13 00:30:04 EDT 2001


Greg Copeland <gtcopeland at earthlink.net> wrote:
> jcm <grumble at usa.net> writes:

>> 
>> Well, I say this because I've written a mud engine in Python and it's
>> slow.  Using this engine on a PII 266 running RedHat 6.1, 400
>> wandering monsters (with nothing else going on in the mud) will peg
>> the cpu.  In a production mud, you might want to do something
>> intelligent about wandering monsters (like have them stop wandering if
>> no players are nearby to save cpu-time), but there will also be lots
>> else going on.
>> 
>> There might be some clever optimizations that could be made.  Anyway,
>> my only point was that computation-speed can become an issue.

> Don't take this the wrong way, but you shouldn't expect the language of
> choice to make up for what sounds like a poor design.  No matter what
> language you use, you have to have a sound design that will meet all of
> your requirements (speed and scalability included).  Once you have a good
> design, python makes for an excellent prototype bench.  See how well it
> runs and profile it.  The areas that still don't perform well, many
> need to be optimized either via redesign or re-implementation of existing
> design.  If after all that is done, and you KNOW you have a good design,
> but python still isn't up to the task, well then you know that another
> scripting language probably wouldn't of fit the bill either.  Now, you
> have an excellent design and a fast working prototype, so now you are
> free to reimplement in another, faster language (C, C++, pascal, etc).

I wouldn't assume that something is designed poorly because it runs
slowly.  We've coded, profiled, optimized, rearchitectured, etc.
Things are slow because of the level of generality we wanted.  I'm sure
that commonly occuring events could be special-cased and speeded up.
Anyway, this project isn't one that I'm working on anymore (probably
permanently shelved), so I'm really not interested in going into
specifics.

And since I'm not willing to put the effort into packaging and posting
the code (nevermind actually finishing the changes that I have
half-complete), it was probably a bad idea to mention anything about
the mud at all in a newsgroup.



More information about the Python-list mailing list