Why Strings as Classes?

Jb jb at nowhere.com
Tue Aug 26 16:21:23 PDT 2008


"Walter Bright" <newshound1 at digitalmars.com> wrote in message 
news:g91kah$1rvb$1 at digitalmars.com...
> 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

True. I'd add this to the list aswell..

4. Shorter dependance chains => faster execution.

Although it's more relevant for floating point where most ops have at least 
a few cycles latency. 





More information about the Digitalmars-d mailing list