Boost logo

Boost :

Subject: Re: [boost] [Fibers] Performance
From: Oliver Kowalke (oliver.kowalke_at_[hidden])
Date: 2014-01-15 08:25:47


2014/1/15 Hartmut Kaiser <hartmut.kaiser_at_[hidden]>

> > Like any C++ probably Boost.Fiber makes many malloc calls per context
> > switch. It adds up.
>
> I don't think that things like a context switch require any memory
> allocation. All you do is to flush the registers, flip the stack pointer,
> and load the registers from the new stack.
>

the context switch itself does not required memory allocation but the
function/functor
to be executed in the fiber must be stored (type erased) inside the fiber.
the current implementation of fiber does allocate internally an object
holding the fiber-function.
I think it is possible to store the function/functor on top of the stack
used by the fiber and thus prevent
the need for memory allocation to hold the function/functor.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk