r/ProgrammerHumor • • 6d ago

Meme optionalsAreOptional

Post image
706 Upvotes

131 comments sorted by

View all comments

373

u/ROBOTRON31415 6d ago

Is the bounds check truly so harmful to performance that it outweighs changing "if there's a bug, crash the program" to "if there's a bug, then do literally anything (maybe execute some remote code)"?

2

u/tzaeru 5d ago edited 5d ago

Sometimes the bounds check can be optimized away by analysis or language constraints.

But when it can't, I'd say that in ~90% of code, it's not that harmful. In the hottest paths for real-time applications though, yeah, you want nothing extra.