4 ms·
Error checks are almost free and can be considered zero cost because branch predictor works really well with error checks (because errors are rare). Branch pred
by chaotic-good 10y ago
Error checks are almost free and can be considered zero cost because branch predictor works really well with error checks (because errors are rare). Branch predictor uses some space in L1 cache to store tables so it's not 100% free but very close to that. Exceptions aren't zero cost either but you're paying for them only when an error occurs most of the time.