MOO-cows Mailing List Archive

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

[rj@eli.wariat.org: Re: Server Improvement]



------- Start of forwarded message -------
Return-Path: moo-cows-errors@parc.xerox.com
Date: Tue, 18 Mar 1997 20:56:49 PST
From: "Robert J. Brown" <rj@eli.wariat.org>
To: jwatkins@futurepress.com
CC: moo-cows@parc.xerox.com
In-reply-to: <199703182353.PAA26684@terra.futurepress.com> (message from Jeff
	Watkins on Tue, 18 Mar 1997 15:51:51 PST)
Subject: Re: Server Improvement
Sender: MOO-Cows-Errors@parc.xerox.com
Precedence: bulk

>>>>> "Jeff" == Jeff Watkins <jwatkins@futurepress.com> writes:

    Jeff> Robert Jay Brown wrote:
    >> A function call with a signature of void (*func)(void) passes
    >> no parameters, and returns no results.  Consequently, it is
    >> quite fast, and generates a single subroutine call instruction,
    >> with no stack pushing or popping other than the return address
    >> itself.  The overhead here is a single memory cycle for call,
    >> and another single memory cycle for returning.

    Jeff> Sorry, but even a void function must push local variables
    Jeff> onto the stack.  On almost every processor family I've ever
    Jeff> written assembly for (five and growing) a jump table (such
    Jeff> as might be used in a switch statement) is better than a
    Jeff> subroutine.

I agree, and I have written for many mor than 5 cpu's in assembler.
My point was that you only pay a 2 cycle penalty for the call and
return.  Since you do not normally use local variables when a jump
table is used, as the code strips are not in a separate block, then
the assumption is that you don't need them for the thunks that would
be called by an array of subroutine pointers either, hence the 2 cycle
overhead statement still applies.

- -- 
- --------  "And there came a writing to him from Elijah"  [2Ch 21:12]  --------
Robert Jay Brown III  rj@eli.wariat.org  http://eli.wariat.org  1 847 705-0424
Elijah Laboratories Inc.;  37 South Greenwood Avenue;  Palatine, IL 60067-6328
- -----  M o d e l i n g   t h e   M e t h o d s   o f   t h e   M i n d  ------
------- End of forwarded message -------


Home | Subject Index | Thread Index