3 ms·
Like I said, performance predictability, not raw performance. if/else have predictable performance characteristics, while exceptions are fast usually and then o
by joshuamorton 7y ago
Like I said, performance predictability, not raw performance. if/else have predictable performance characteristics, while exceptions are fast usually and then occasionally very slow.
The idea being that in an area where you'd like performance to be predictable, even in cases of unexpected results, Sum types or if/else give the same performance all the time.
- rumanator 7y ago> Like I said, performance predictability, not raw performance. Your argument makes absolutely no sense. Exceptions are used to handle exceptional events, the kind of stuff that would crash and shutdown your program. Exceptions are used to establish sanity checkpoints where any exceptional event can be caught and either recover from it or fail gracefully. Performance is measured on the happy path, and exceptions fall in the exact opposite of the happy path.
- joshuamorton 7y agoThere are cases where you want exceptional performance to also have predictable characteristics. I don't know why that doesn't make sense.