3 ms·
get/setcontext do not copy stack, but use an allocated bit of memory space for the stack and swaps stack pointers just like this implementation. I don't see how
by nanofortnight 13y ago
get/setcontext do not copy stack, but use an allocated bit of memory space for the stack and swaps stack pointers just like this implementation. I don't see how that's a performance hit.
I do not pretend to know about Windows internals so I won't comment on Windows.
- vinkelhake 13y agoThe author of boost.context did some benchmarking[1] and found that get/setcontext was an order of magnitude slower than a custom solution. Whether this matters is an entirely different question, but it's clear that get/setcontext has some overhead. [1] http://www.boost.org/doc/libs/1_54_0/libs/context/doc/html/context/performance.html http://www.boost.org/doc/libs/1_54_0/libs/context/doc/html/c...
- cygx 13y agoSee also the notes on various implementation mechanisms of libcoro ( http://cvs.schmorp.de/libcoro/coro.h http://cvs.schmorp.de/libcoro/coro.h )
- davidtgoldblatt 13y agogetcontext and setcontext also keep track of signal state, which involves a syscall.