4 ms·
I tested this and it does indeed eliminate that code.
by helper 7y ago
I tested this and it does indeed eliminate that code.
- deathanatos 7y agoI'm wondering if it inlines it (and thus eliminates it). But this would come with a performance penalty: it makes the function you assert() in no longer a leaf function (it calls assert()) and AFAIK, Go only inlines leaf functions. (So, any function in which you call assert() is no longer eligible for inlining.)
- helper 7y agochrchang523 is correct. In my test the caller function can still get inlined.
- chrchang523 7y agodeathanatos: Go 1.12 can inline non-leaf functions, and I’d be surprised if it still fails to do the right thing here.