Expand description
PERF-7: the item path — each item encoded once, straight into the frame its socket writes. PERF-7: the item path — an item encoded once, by its method’s own event type, straight into a buffer its socket writes from.
| when | then |
|---|---|
a method yields an event under the WebSocket pipe (pipe) | wrap_stream serializes it once, by its own Serialize, into the pipe’s buffer (a block from its connection’s pool); the Data item carries it as Content — JSON bytes, no Value |
| the same event anywhere else (in process, a nested route, a test) | it becomes a Value as before: in-process items stay what they cost |
a transformer reads a Data item’s content | Content decodes its bytes once, on demand (Deref to Value); one that rewrites it replaces the whole Content — an encoded item is a Data item, so no rewrite can miss one (PERF-17’s finding: the gated view’s rewrite did) |
| the pipe writes an item | the notification’s prefix (once a call), the metadata (once a stream), the content type and the content’s bytes, and the suffix, into the same buffer: one frame, split off as Bytes (no allocation while the block has room) |
the transport offers a FrameSink (plexus-transport’s socket loop) | the frame goes to the socket’s writer as it is; the call’s first frame is fenced, so it follows the subscription’s answer that jsonrpsee queued |
| it does not (jsonrpsee’s own sink: stdio, an in-memory module) | the item’s bytes go to the sink as one raw value, as before |
one change fans out to N watchers (Shared) | the first socket that sends it encodes it, once; every other writes those bytes |
PERF-8 batches frames from here (results: […]), PERF-9 adds an encoding
(WireEncoding), PERF-13 relays a child’s content as bytes.
Structs§
- Content
- A
dataitem’s content: the method’s event, encoded once (JSON bytes), or aValue— whichever the item was made with. Reads as aValueeither way (Content::value,Deref), the bytes decoded once on demand; serializes as its JSON. Equal as JSON is equal. - Frame
Sink - The frames a transport takes from a connection’s calls (plexus-transport’s socket loop puts one in each call’s extensions): each item a frame, in order, written as it is. Cheap to clone.
- Shared
- An event many streams send — one change fanned out to every watcher.
The first socket that sends it encodes it, once; every other writes
those bytes as they are (PERF-7’s fan-out). Anywhere else (in process, a
Value, another encoding) it serializes asTdoes. Reads asT. - Wire
Frame - A frame ready for a socket, in its connection’s encoding.
Enums§
- Wire
Encoding - The encoding of every frame on a connection, fixed when it opens. JSON text until PERF-9 adds msgpack.
Functions§
- pipe
- Pipe a call’s stream to its accepted subscription: each item encoded once and written as one frame.
Type Aliases§
- Frame
Receiver - What the transport’s writer reads a
FrameSink’s frames from.