morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
async.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2
3#pragma once
4
5/// @file
6/// @brief The asynchronous primitives, on their own — the cheap include.
7///
8/// `Completion`, `IExecutor` and its implementations, the strands and
9/// `CallbackScope` are useful without a model, a registry, a wire envelope or a
10/// schema, and they are the part of morph that costs almost nothing to compile.
11/// Nothing here reaches glaze.
12///
13/// Measured with clang 22.1.8, `-O2 -fsyntax-only`, one translation unit per
14/// header, best of three:
15///
16/// | header | CPU s | preprocessed lines |
17/// |---|---|---|
18/// | `core/executor.hpp` | 1.16 | 124,855 |
19/// | `core/completion.hpp` | 1.20 | 127,450 |
20/// | `core/strand.hpp` | 1.20 | 127,217 |
21/// | `core/bridge.hpp` | 3.76 | 267,827 |
22///
23/// A consumer that wants the primitives and reaches for `bridge.hpp` — the
24/// obvious header, and the one every example includes — pays roughly three
25/// times over for a schema generator and a JSON codec it never calls. This
26/// header exists so the cheap path has a name.
27///
28/// It is a facade and nothing else: it declares no symbol of its own, so
29/// including it is exactly equivalent to including the four headers below.
30
31#include "callback_scope.hpp"
32#include "completion.hpp"
33#include "executor.hpp"
34#include "strand.hpp"
morph's strands: one per model instance, from core-cpp's core::async::KeyedStrands,...