3 ms·
The solution to this is to not use exceptions except for actual errors, unless it's going to be amortized away. For example, objects which have a heavy paramet
by klyrs 3y ago
The solution to this is to not use exceptions except for actual errors, unless it's going to be amortized away. For example, objects which have a heavy parameter, which gets memoized. With the zero-cost happy path, you only raise the exception once, when you're doing the costly thing, and subsequent accesses are free.