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 something with switching program flow what I am missing? My question is programming language agnostic (I hope so, but prove me wrong). However If you need some anchor then I am interest the most in .NET internals related with this topic.
EDIT2:
I don't have any issues with exceptions performance. I just would like to understand internals of this mechanism.
EDIT3:
Made my question more clear.
Exception handling requires some complexity and "magic". Seconding @Joni's response a major cost is gathering the stack trace. When an exception is thrown, the run time has to walk down the stack's activation records looking for a compatible exception handler, executing finally blocks each step of the way. All this has to occur at run time; it can't be fixed up by the compiler. In languages like C++ destructors have to be executed.
Exception processing is essentially an out of band "exceptional" processing mode. Things that speed up normal execution such as caching don't work as well. (I would imagine locality-of-reference is a lot worse here). This processing could be optimized, but since exc handing is supposed to be "special" it's given less attention.