如何提升实现信号和槽? [英] How does boost implements signals and slots?
问题描述
要继续另一个问题,让问这个:
To continue another question, lets ask this:
如何提升执行的信号/插槽机制?
How does Boost implement the signals/slot mechanism?
请参阅:
<一href=\"http://stackoverflow.com/questions/1406940/how-signal-and-slots-are-implemented-under-the-hood\">http://stackoverflow.com/questions/1406940/how-signal-and-slots-are-implemented-under-the-hood
http://www.boost.org/doc /libs/1%5F40%5F0/doc/html/signals.html
推荐答案
下面是从的这个gamedev.net线程得到讨论滚动
here's an interesting snippet from this gamedev.net thread to get the discussion rolling
原帖由Spoonbender所以,奖金
问题:是什么原因导致的boost ::信号
是的是的慢很多?
Original post by Spoonbender So, bonus question: What causes boost::signals to be that much slower?
它看起来像有一对夫妇
BIGGIES。首先,尽管
提高::信号不是线程安全的,它
进入和离开临界区一
几次。其次,有
这个命名槽啄这似乎
结果过于复杂的数据
这需要很长的时间结构
遍历。然后还有很多
从各种镍 - 和 - 迪明
看家的东西它。最后,
个别调用具有高得多
开销,因为升压::绑定的
runtiminess。它的所有功能
我敢肯定有人有需要,
但我不知道。
It looks like there are a couple of biggies. First, despite the fact that boost::signals isn't threadsafe, it enters and leaves critical sections a couple of times. Secondly, there's this named-slots thingy which seems to result in overly complex data structures which take a long time to iterate over. And then there's a lot of nickel-and-diming from various housekeeping things it does. Finally, the individual calls have much higher overhead because of boost::bind's runtiminess. It's all functionality that I'm sure someone has a need for, but I don't.
这篇关于如何提升实现信号和槽?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!