在C ++中测量异常处理开销 [英] Measuring exception handling overhead in C++

查看:92
本文介绍了在C ++中测量异常处理开销的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在C ++中测量异常处理开销/性能的最佳方法是什么?

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

请提供独立的代码示例。

Please give standalone code samples.

我的目标是Microsoft Visual C ++ 2008和gcc。

I'm targeting Microsoft Visual C++ 2008 and gcc.

我需要从以下情况获得结果:

I need to get results from the following cases:


  1. 没有try / catch块时会产生开销

  2. 当有try / catch块但不抛出异常时会产生开销

  3. 抛出异常时的开销


推荐答案

关于C ++性能的技术报告草稿完全专注于异常的开销。

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

这篇关于在C ++中测量异常处理开销的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆