Hacker News new | ask | show | jobs
by bsder 570 days ago
"Using runtime assert() in a tight performance loop can impact performance?" Um, like ... duh?

Run time checks should simply be enabled. Normally, you're checking some context on entry or exit from a function. 99% of the time it simply won't matter to performance. And, when it does, it will pop out at you and you can remove it.

The bigger issue as alluded to is assert() in libraries. As a user, you can't add an assert() to a library. And also, as a user, you can't remove an assert() that is getting in your way.

1 comments

Yeah, assert in a performance loop is generally a mistake.