4 ms·
And in terms of performance it costs next to nothing. Just don't put them into your critical loops. You can also print backtraces when an assertion fails: http
by okl 6y ago
And in terms of performance it costs next to nothing. Just don't put them into your critical loops.
You can also print backtraces when an assertion fails: https://stackoverflow.com/questions/77005/how-to-automatically-generate-a-stacktrace-when-my-program-crashes https://stackoverflow.com/questions/77005/how-to-automatical...
- Someone 6y agoDepends on what’s in your asserts. If, for example, you check validity of your custom data structure in an assert, even a single assert can cost a lot to more than nothing. (Whether you should use assert for that kind of checks that probably only should run in tests is debatable, but it sometimes happens)