On Wed, Aug 20, 2014 at 11:20 AM, Johan Tibell <johan.tibell@gmail.com> wrote:
On Wed, Aug 20, 2014 at 11:05 AM, Johan Holmquist <holmisen@gmail.com> wrote:
> I think the reason it isn't done is that it's not always an optimization

Could you explain when it's not?

A simple example is when the two values aren't equal, as you'll be doing one more branch than you otherwise would.

True
 
The extra branch might also hurt the branch predictor even in the equal case, if the branch is hard to predict.


This cost I think we can completely eliminate.  If the pointer comparison is done only for an Eq instance that is statically known to execute N instructions, then as as long as the cost of all subsequent branch mispredictions are less than N, then we win, always.

Alexander
 
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe