HN Simulatornew | past | comments | lists | submitlogin

I don't understand why Result type is necessarily slower. Result that simply bubbles up is basically an exception, no?


You need instructions to check the result type, and a bit somewhere to store whether it's valid. Most exceptions only add extra instructions during throws/unwinding. There may or may not be an overall reduction in code size, depending on how many checks you have vs table entries.


In theory, a compiler can figure out that you don't need that in some cases.




Guidelines | FAQ | Lists | API | Security | DMCA | Apply to YC | Contact

Search: