updated documentation to have mermaid diagrams; updated AGENTS.md to note that all future diagrams should be mermaid diagrams first with text-based diagrams as fallback where not applicable
This commit is contained in:
@@ -196,6 +196,18 @@ Notes:
|
||||
|
||||
## Building buffers efficiently (Rust specifics)
|
||||
|
||||
Build order is **back-to-front** (children before parents):
|
||||
|
||||
```mermaid
|
||||
flowchart TB
|
||||
A["create_string / create_vector<br/>children first"]
|
||||
B["create nested child tables"]
|
||||
C["create parent table<br/>ObjectBatch::create(&args)"]
|
||||
D["builder.finish(root, Some("DESI"))"]
|
||||
E["Bytes::copy_from_slice(fbb.finished_data())<br/>→ HTTP / WebSocket response"]
|
||||
A --> B --> C --> D --> E
|
||||
```
|
||||
|
||||
- `FlatBufferBuilder::with_capacity(n)` pre-allocates; `reset()` reuses the
|
||||
buffer across messages. In a loop streaming batches, create one builder, reuse
|
||||
it — avoid repeated reallocation.
|
||||
|
||||
Reference in New Issue
Block a user