...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Performance of Boost.Context was measured
on the platforms shown in the following table. Performance measurements were
taken using rdtsc
, with overhead
corrections, on x86 platforms. In each case, stack protection was active, cache
warm-up was accounted for, and the one running thread was pinned to a single
CPU. The code was compiled using the build options, 'variant = release cxxflags
= -DBOOST_DISABLE_ASSERTS'.
Applying -DBOOST_USE_UCONTEXT
to cxxflags the performance of ucontext
will be measured too.
The numbers in the table are the number of cycles per iteration, based upon an average computed over 10 iterations.
Table 1. Performance of context switch
Platform |
ucontext_t |
fcontext_t with fpu |
fcontext_t without fpu |
boost::function |
---|---|---|---|---|
AMD Athlon 64 DualCore 4400+ (32bit Linux) |
846 cycles |
65 cycles |
43 cycles |
15 cycles |
Intel Core2 Q6700 (64bit Linux) |
1481 cycles |
172 cycles |
63 cycles |
25 cycles |