Date : Wed, 14 Feb 1996 21:58:55 +0000 (GMT)
From : James Fidell <james@...>
Subject: Re: The BBC's Logical, Well-Documented and Non-Perverse Keyboard
Mark Cook wrote:
> > Tom Seddon wrote:
> >
> > ;Now, I have another problem. My virtual BBC is now about 33% slower
than
> > ;a real BBC, on a 486dx2-80. After I've done the obvious optimisations
> > ;(update VIA clocks every X cycles, that sort of thing), if the speed
> > ;isn't up to scratch what do people suggest?
> >
> >
> > Here are a few nice tricks.
> >
> > 1) Use a big SWITCH statement as the heart of your 6502 emulation.
>
> Depending on your compiler. A potentially better trick is to use an array
> of function pointers. Mileage will vary with compiler.
I think this is unlikely. Most C compilers will turn a large switch
statement into a table lookup for a jump address to the actual code for
the case. (Small switch statements usually get coded as cascading 'if'
statements in the compilers I've looked at.)
A call via an array of function pointers will have to do the table lookup
and then has all the overhead of stack manipulation that goes with the
function all.
James.
--
"Yield to temptation -- | Work: james@...
it may not pass your way again" | Play: james@...
| http://www.OiT.co.uk/~james/
- Lazarus Long | James Fidell