发布版本中与OutputDebugString关联的开销 [英] Overhead associated with OutputDebugString in release build

查看:57
本文介绍了发布版本中与OutputDebugString关联的开销的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在发布版本中调用OutputDebugString是否有大量开销?

Is there a significant overhead associated with calling OutputDebugString in release build?

推荐答案

已测量-10M通话大约需要50秒.我认为对于未使用的功能,这是很大的开销.

Measured - 10M calls take about 50 seconds. I think it's significant overhead for unused functionality.

使用宏可以帮助在发行版本中摆脱这种情况:

Using a macro can help get rid of this in release build:

#ifdef _DEBUG
    #define LOGMESSAGE( str ) OutputDebugString( str );
#else
    #define LOGMESSAGE( str )
#endif

不仅删除了调用,而且参数求值和文本字符串也被完全删除,您不会在二进制文件中看到它们.

Not only removes the calls, but also the parameters evaluation and the text strings are entirely removed and you'll not see them in the binary file.

这篇关于发布版本中与OutputDebugString关联的开销的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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