//assert(someImportantPointer != nullptr);
if(someImportantPointer == nullptr)
return;
For backstory, I'm changing the order of operations of a few critical processes, mostly to exploit batching and coherency opportunities. A lot of the changes are "winging it" because the system is old, not well-understood, and full of unwritten assumptions.
One of the few explicit assumptions in the code is that this pointer is valid at a certain moment of execution. I'm making it invalid, on purpose, for performance gains. I suspect the whole chunk of code is full of potential wins like this one, sometimes a 3-5x speedup depending on circumstances. Trouble is, since the system is critical and legacy as hell, it's very hard to know when you're looking at an easy perf win and when you're looking at a really deep, really ugly rabbit hole.
So today, I'm commenting out an assertion and replacing it with an early-out, because it's legitimately better to just silently fail than to crash.
I feel dirty, but sometimes you do what you have to.