Measuring exception handling overhead in C++

后端 未结 8 574
耶瑟儿~
耶瑟儿~ 2020-12-03 01:42

What is the best way to measure exception handling overhead/performance in C++?

Please give standalone code samples.

I\'m targeting Microsoft Visual C++ 2008

相关标签:
8条回答
  • 2020-12-03 02:38

    Won't the answer depend on what cleanup has to happen as a result of a throw? If an excpetion is thrown that causes a whole load of objects to go out of scope up the stack, then that will add to the overhead.

    In other words, I'm not sure if there is a an answer to the 3rd question that is independent of the specifics of the code.

    0 讨论(0)
  • 2020-12-03 02:42

    Section 5.4 of the draft Technical Report on C++ Performance is entirely devoted to the overhead of exceptions.

    0 讨论(0)
提交回复
热议问题