Why Strings as Classes?

Jb jb at nowhere.com
Tue Aug 26 16:09:18 PDT 2008


"Nick Sabalausky" <a at a.a> wrote in message 
news:g91m3t$222a$1 at digitalmars.com...
> "Jb" <jb at nowhere.com> wrote in message 
> news:g90mm6$2tk9$1 at digitalmars.com...
>>
>> "Walter Bright" <newshound1 at digitalmars.com> wrote in message 
>> news:g90iia$2jc4$3 at digitalmars.com...
>>> Yigal Chripun wrote:
>>>> a) people here said that a virtual call will make it slow. How much
>>>> slow? how much of an overhead is it on modern hardware considering also
>>>> that this is a place where hardware manufacturers spend time on
>>>> optimizations?
>>>
>>> Virtual function calls have been a problem for hardware optimization. 
>>> Direct function calls can be speculatively executed, but not virtual 
>>> ones, because the hardware cannot predict where it will go. This means 
>>> virtual calls can be much slower than direct function calls.
>>
>> Modern x86 branch prediction treats indirect calls the same as 
>> conditional branches. They get a slot in the branch target buffer, so 
>> they do get speculatively executed. And if correctly predicted it's only 
>> a couple of cycles more costly direct calls.
>
> Just curious: How "modern", do you mean by "modern" here?

Well I thought it was the Pentium II, but acording to AgnerFog, it's since 
the PMMX. So pretty much all Pentiums.

Although that's "predict it goes the same place it did last time".

More recent ones do remember multiple targets and recognize some patterns.






More information about the Digitalmars-d mailing list