MOO-cows Mailing List Archive

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

[bjj@sequent.com: Re: Server Improvement]



------- Start of forwarded message -------
Return-Path: moo-cows-errors@parc.xerox.com
X-Authentication-Warning: eng4.sequent.com: Host localhost didn't use HELO protocol
To: moo-cows@parc.xerox.com
Subject: Re: Server Improvement 
Date: Tue, 18 Mar 1997 09:25:03 PST
From: Ben Jackson <bjj@sequent.com>
Sender: MOO-Cows-Errors@parc.xerox.com
Precedence: bulk

> At 03.38 -0800 3/18/97, chris wrote:
> >Switch statements in C are meant to be very efficient (although that
> >might change from compiler to compiler)

For a compact set of cases any decent compiler will generate a jump table.
The resulting code will be much faster than function calls.

However, about 1/4 of all the MOO opcodes executed fall into the default
case and are sorted out by if/else.  By splitting up that case (leaving
default for "fast integers") you can get the one-op push/pop opcodes to
run faster (I can't say if it's measurable in the stock server).  It's
actually possible to make MOO's "null loop" speed though the opcode
switch take only about 5x longer than the equivalent loop in C, but the
speed doesn't come from obvious places.

I would strongly recommend that anyone working on performance enhancements
to any software use profiling information rather than relying on the
"divine inspiration" method.  No matter how slow a particular function
is it won't matter how fast you make it if it's not contributing a
significant percentage of the overall time.  And only profiling can tell
you if your changes had the desired effect.  In the case of run(), which
is hard to profile because so much of the server's time is spent there,
line profiling is useful, and can show you exactly how often particular
cases are executed and whether or not its worth your time to speed them
up.

> >Do people think that this would result in a significant performance boost?

I think it would be a significant performance penalty.

- --Ben
------- End of forwarded message -------


Home | Subject Index | Thread Index