3 ms·
validating with exceptions is good because it makes your code much cleaner to read. the cost benefits of reading and easy maintainability is extremely high the
by foolfoolz 4y ago
validating with exceptions is good because it makes your code much cleaner to read. the cost benefits of reading and easy maintainability is extremely high
the example shows an extra time of 500nanoseconds when not throwing. this is 0.005 milliseconds. if your api takes more than 1ms then changing it to not throw will not be noticeable. even if the exception time cost was 10x higher and it took 0.05ms longer it would not be noticeable