MOO-cows Mailing List Archive
[firstname.lastname@example.org: Server Improvement]
------- Start of forwarded message -------
Date: Tue, 18 Mar 1997 03:38:33 PST
From: chris <email@example.com>
To: MOO-COWs <firstname.lastname@example.org>
Subject: Server Improvement
Content-Type: TEXT/PLAIN; charset=US-ASCII
Switch statements in C are meant to be very efficient (although that
might change from compiler to compiler), and the MOO server uses a switch
statement to select and execute the MOO language operands.
As the server spends so much time executing this code (located in the
function run() in execute.c) any improvement to its performance would
have a significant impact on the performance of the site.
What I would like to put up for discussion is the merits of using a array
of pointers to functions instead of a switch statement, as this would
eleminate the need to perform a integer search.
The server already uses enumerations in a switch statement, the
enumerations are integer codes which signal performing a addition
operation or to pop a value from the stack and so forth. If the code for
each operation was inserted into a function, and the address of the
function stored in a array then the value of the enumeration could be
used as a offset to retrieve the address of the function which should be
called. Surely a quick sum is quicker to compute than a search of a
Do people think that this would result in a significant performance boost?
------- End of forwarded message -------
Subject Index |