Hacker News new | ask | show | jobs
by twtw 2757 days ago
> But I'd interested in seeing firm numbers on this.

From Regehr's blog post that you linked:

> An issue with mitigating integer UBs is the overhead. For example, they cause SPEC CPU 2006 to run about 30% slower.

1 comments

I think this is the overhead for mitigating by adding additional code (a branch on overflow that can be predicted as not taken), rather than the cost of lost optimizations that could have been used by assuming that UB does not occur. So a useful number, but measuring something else.

Although perhaps it can be used an an upper bound on the boost provided UB-free optimizations? That is, the overflow checking has both a direct cost, and prevents certain beneficial optimizations. Thus we can assume that the optimization benefit (on SPEC CPU 2006) is something less than 30%. That is to say, real, but not enormous compared to an algorithmic difference.

> I think this is the overhead for mitigating by adding additional code

I think so too - as OP just said "dealing with," it wasn't clear to me that you were talking about just ignoring rather than handling.