firedancer-io / firedancer

Firedancer is Jump Crypto's Solana consensus node implementation.
https://firedancer.io
Other
768 stars 130 forks source link

High performance persistent shared scratch pads #2261

Closed kbowers-jump closed 5 days ago

kbowers-jump commented 6 days ago

By popular demand, this is a more general implementation of the non-alloca parts of util/scratch (and it probably makes sense at some point to convert the util/scratch equivalents to use this under the hood).

From the documentation, a spad is a scratch pad that behaves very much like a thread's stack:

Unlike a thread's stack, the most recent allocation can be trimmed, the most recent sequence of allocations be undone, operations on a spad can by done more than one thread, threads can operate on multiple spads and, if the spad is backed by a shared memory region (e.g. wksp), spad allocations can be shared with different processes. Also, it flexibly supports tight integration with real-time streaming, custom allocation alignments, programmatic usage queries, validation, and a large dynamic range of allocation sizes and alignments. Further, the API can be changed at compile time to implementations with extra instrumentation for debugging and/or sanitization.