4 ms·
Well it depends on your circumstances. If you care so much about performance in the code path that you do benchmarks to find out how you should be doing your er
by fefe23 7y ago
Well it depends on your circumstances. If you care so much about performance in the code path that you do benchmarks to find out how you should be doing your error handling, then you should not be using exceptions.
Even if the metadata is loaded after the first time, the error handling code will probably still need to be fetched from disk.
Most programs are not performance critical and you can use whatever you want for exception handling. Heck, modern microservice based architectures use message busses and network sockets for error handling. I have seen code signal error conditions by writing things to a database.
By the way: Syscalls have become amazingly fast. Some syscalls like gettimeofday are now even done without switching to kernel mode at all. And the raw kernel mode switch is now in the order of hundreds of cycles. I read something like 300 cycles for a modern architecture.
Also note that while regular performance is probably not so important, in some areas like hard real-time requirements for automotive or aviation it might still be relevant that your code has a predictable maximum latency.