Why is throwing exceptions so slow?
They are telling us not to use exceptions to control flow of our programs because throwing exceptions is slow. I have never heard any explanation why is throwing exceptions so slow. So the question is: What is the mechanism of throwing exceptions and what are particular operations involved which may have performance impact? EDIT: Some clarification: I would like to hear what extra work is need by operation system to handle throwing exceptions. Is there some switching between user and kernel mode which are that costly? Or maybe constructing exception object is costly? Or maybe there is