Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you need fast delegates and event system take a look to Offirmo: It is as fast as the "<a href="http://www.codeproject.com/Articles/11015/The-Impossibly-Fast-C-Delegates" rel="nofollow">Fastest possible delegates</a>", but it has 2 major advantages:</p> <p>1) it is ready and well tested library (don't need to write your own library from an article)</p> <p>2) Does not relies on compiler hacks (fully compliant to C++ standard)</p> <p><a href="https://github.com/Offirmo/impossibly-fast-delegates" rel="nofollow">https://github.com/Offirmo/impossibly-fast-delegates</a></p> <p>If you need a managed signal/slot system I have developed <a href="http://sourceforge.net/p/badeengine/code/ci/master/tree/bade/Common/" rel="nofollow">my own(c++11 only)</a>.</p> <p>It is not fast as Offirmo, but is fast enough for any real scenario, most important is order of magnitude faster than Qt or Boost signals and is simple to use.</p> <ul> <li>Signal is responsible for firing events.</li> <li>Slots are responsible for holding callbacks.</li> <li>Connect how many Slots as you wish to a Signal.</li> <li>Don't warry about lifetime (everything autodisconnect)</li> </ul> <p><strong>Performance considerations:</strong></p> <p>The overhead for a std::function is quite low (and improving with every compiler release). Actually is just a bit slower than a regular function call. My own signal/slot library, is capable of 250 millions(I measured the pure overhead) callbacks/second on a 2Ghz processor and is using std::function.</p> <p>Since your code has to do with network stuff you should mind that your <strong>main bottleneck will be the sockets.</strong></p> <p>The <strong>second bottleneck is latency of instruction cache</strong>. It does not matter if you use Offirmo (few assembly instructions), or std::function. Most of the time is spent by fetchin instructions from L1 cache. The best optimization is to keep all callbacks code compiled in the same translation unit (same .cpp file) and possibly in the same order in wich callbacks are called (or mostly the same order), after you do that you'll see only a very tiny improvement using Offirmo (seriously, you CAN'T BE faster than Offirmo) over std::function. </p> <p>Keep in mind that any function doing something really usefull would be at least few dozens instructions (especially if dealing with sockets: you'll have to wait completion of system calls and processor context switch..) so the overhead of the callback system will be neglictible.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload