3 ms·
> Side note: I've never understood the convention of removing asserts in production builds. It seems like removing the seatbelts from the car before the race ju
by zarzavat 2y ago
> Side note: I've never understood the convention of removing asserts in production builds. It seems like removing the seatbelts from the car before the race just to save a few pounds.
Once an upon a time computers were slow and every cycle mattered. Assertions were compiled out of the build by necessity. Better a crash once in a while than the program hardly running because it was so slow.
- drzaiusx11 2y agoCase in point: When I was stuck inside a "big ball of perl" codebase that heavily used assertions for method input validation, I generated a flame graph of where time was spent in the codebase and it turned out it was assertions all the way down. Since only a small percentage of inputs came from external/unvalidated sources (user input etc) it was fine to remove the vast majority of them outside of the development environment. So we turned them into no-ops in prod and had a significant performance improvement.
- zbentley 2y agoWouldn’t happen to have been a big healthcare company in Boston whose assert-anything function to validate that functions were called with correct signatures was called AssertFields?
- drzaiusx11 2y agoAs it happens, it was at such a place exactly as you describe. Hello fellow traveler, our paths may have crossed.