什么是性病::功能的性能开销? [英] What is the performance overhead of std::function?

查看:105
本文介绍了什么是性病::功能的性能开销?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我听到有关使用论坛的std ::功能<> 会导致性能下降。是真的吗?如果属实,这是一个很大的性能下降?

I heard on a forum using std::function<> causes performance drop. Is it true? If true, is it a big performance drop?

推荐答案

您可以找到升压的参考材料信息:的的开销如何通过升压::功能承担?和<一通话href=\"http://www.boost.org/doc/libs/1_45_0/doc/html/function/misc.html#id1285061\">Performance

You can find information from the boost's reference materials: How much overhead does a call through boost::function incur? and Performance

这并不能确定是或否来提振作用。给定的程序要求的性能下降可能是很好接受的。通常情况下,一个项目的部分不是性能关键。而且即便如此,它是可以接受的。这是唯一的东西,你可以决定。

This doesn't determine "yes or no" to boost function. The performance drop may be well acceptable given program's requirements. More often than not, parts of a program are not performance-critical. And even then it may be acceptable. This is only something you can determine.

至于标准库版本,该标准仅定义了一个接口。这完全取决于个人的实现,使其工作。我想,有着相似的应用,以提高的功能将被使用。

As to the standard library version, the standard only defines an interface. It is entirely up to individual implementations to make it work. I suppose a similar implementation to boost's function would be used.

这篇关于什么是性病::功能的性能开销?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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