Re: [Scheme-reports] eq? considered harmful. Ray Dillinger (14 Aug 2012 02:31 UTC)
Re: eq? considered harmful. Arthur A. Gleckler (14 Aug 2012 02:56 UTC)
Re: [Scheme-reports] eq? considered harmful. Mark H Weaver (14 Aug 2012 05:33 UTC)

Re: [Scheme-reports] eq? considered harmful. Mark H Weaver 14 Aug 2012 05:33 UTC

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@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports