Dynamic array comparison optimization: check for equal pointers?

NaN divide at by.zero
Tue Jun 2 22:24:18 UTC 2020


On Tuesday, 2 June 2020 at 22:05:06 UTC, Johan wrote:
> On Tuesday, 2 June 2020 at 21:27:44 UTC, Dominikus Dittes 
> Scherkl wrote:
>
> glibc is a very commonly used library for memcmp. It does many 
> other checks before starting the comparison (e.g. optimizing 
> for pointer alignment), so the cost of the extra check is 
> perhaps not even measurable.

Getting two pointers to the same memory location may be such a 
rare occurrence that it's not worth having the check for it. IE, 
Adding a tiny overhead on 1000 calls can still cost more than a 
very large overhead on 1 call.


More information about the Digitalmars-d mailing list