Why Strings as Classes?

Walter Bright newshound1 at digitalmars.com
Tue Aug 26 12:08:02 PDT 2008


Jb wrote:
> Walter said "the hardware cannot predict where a virtual call will go".
> 
> It does in fact predict them, and speculatively execute them, and as pretty 
> much any bechmark will show it gets it right the vast majority of the time. 
> (On x86 anyway.)
> 
> That's what I was saying. 

Looks like I keep falling behind on what modern CPUs are doing :-(

In any case, throughout all the revolutions in how CPUs work, there have 
been a few invariants that hold true well enough as an optimization guide:

1. fewer instructions ==> faster execution
2. fewer memory accesses ==> faster execution
3. fewer conditional branches ==> faster execution



More information about the Digitalmars-d mailing list