[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] eq? considered harmful.



On 08/13/2012 10:30 PM, Ray Dillinger wrote:
 > A typetag check and nonbranching
 > execution of a conditional branch is 2 machine code instructions,

I agree with most of what you've written on this subject, but on this 
point I'm skeptical.  I suspect that the difference in code size between 
'eq?' and an efficient 'eqv?' is much more than just two instructions.

'eq?' requires two instructions.  Compare and branch.

Can you please outline your proposed machine pseudo-code for 'eqv?',
for a typical representation where the low three bits are the type tag?

Also, the fact that you specifically wrote "nonbranching execution of a 
conditional branch" makes me suspect that your mental model of branch 
prediction is out of date.  Modern Intel processors do not support 
static branch prediction.  Furthermore they use global branch 
prediction, based on a branch history buffer and a history pattern 
table, which means that every conditional branch dilutes the history 
buffer and thus reduces the effectiveness of branch prediction.  For 
details on branch prediction on popular contemporary processors, see 
"The microarchitecture of Intel, AMD and VIA CPUs" by Agner Fog:

http://www.agner.org/optimize/microarchitecture.pdf

      Mark

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports