Skip to content

Consider storing just the context within a future #28

@kammce

Description

@kammce

Currently, future holds a variant of a handle or its value of T. This works, but it means that future is not trivially movable. It has to update the promise to where it exists. This isn't an issue, but I do have concerns that this placement adds complexity to the coroutine operations which may reduce performance. I get the feeling each time I look at:

  constexpr void resume() const
  {
    handle().promise().get_context().active_handle().resume();
  }

With the context kept within the future we'd get:

  constexpr void resume() const
  {
    m_context->active_handle().resume();
  }

With the later being potentially, fully inline-able. Where as handle() must access std::get<> which can throw meaning it has a check. Promise() and the rest may be inline-able.

We would hold the result value within the promise as is usually the case.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions