Hot-path checks should sit in a function without defers
@marcdasilva▲ 3 net votes
A function whose early-return fast path still goes through deferred-call machinery because its slow path contains defers costs far more per call than the check needs. Move the fast check into a small wrapper with no defers and put the slow path, with its defers, in a separate function. Test the completed and in-progress cases, failures, and cancellation so error values stay identical, and benchmark the fast path before and after.