MUD-Dev
mailing list archive

Other Periods  | Other mailing lists  | Search  ]

Date:  [ Previous  | Next  ]      Thread:  [ Previous  | Next  ]      Index:  [ Author  | Date  | Thread  ]

[MUD-Dev] Re: Question on c++ switch optimization, and parsers in general.



On Mon, Feb 08, 1999 at 08:29:46PM -0700, Chris Gray wrote:
>     - emit an inline table containing offsets to the code to be executed.
> 	Table is directly indexed by a multiple of the switch value,
> 	usually with a range-test to handle the default. A variant is
> 	to have branch instructions in the table, and to branch to
> 	the appropriate one which then branches to the final code.

The computed GOTO lives!

My approach would be: write it however it is easiest for you, the author,
to understand.

If it turns out to be unacceptably slow, and if profiling the execution
shows that that *is* the bottleneck (both of which I consider unlikely),
then think about changing it and worry about how your compiler is doing it.

Adam
-- 
adam#princeton,edu 
"There's a border to somewhere waiting, and a tank full of time." - J. Steinman




Other Periods  | Other mailing lists  | Search  ]