3 ms·
> At this point UB and leveraging it for optimization are core parts of the most performant C implementations. I am skeptical that NULL-pointer checks being re
by lelanthran 5mo ago
> At this point UB and leveraging it for optimization are core parts of the most performant C implementations.
I am skeptical that NULL-pointer checks being removed contribute anything more than a rounding error in performance gains in any non-trivial program.
- charleslmunger 5mo agoI got a measurable improvement from eliminating a null pointer check within the last week. Billions of devices have arm little cores, and the extra branch predictor pressure and frontend bandwidth from those instructions can be significant. A standard way to eliminate those is to invoke undefined behavior if some condition is not met; if (a == NULL) { __builtin_unreachable(); } Which then allows elimination of the null check in later code, possibly after inlining some function.