Skip to content

Binary Format (ASUN-BIN) ​

ASUN-BIN is the binary companion to ASUN text. It targets internal service communication, caches, and storage where readability is no longer required.

When to Use It ​

ScenarioRecommended format
LLM prompts and responsesASUN text
Human-readable files or logsASUN text
Internal service boundariesASUN-BIN
Cache valuesASUN-BIN
Disk snapshotsASUN-BIN

What It Optimizes For ​

  • compact typed representation
  • stable field order
  • fast encode and decode in one runtime
  • less text parsing work

Performance Notes ​

Binary mode is usually where ASUN shows its strongest speed profile, but the result is still implementation-specific.

  • Rust currently has the most mature binary benchmark set.
  • Native implementations usually benefit the most.
  • Cross-language interchange should still prefer ASUN text.

For implementation-level notes, see benchmark notes.

Wire Model ​

All integers are little-endian. Strings are length-prefixed.

TypeEncoding
bool1 byte
i8 / u81 byte
i16 / u162 bytes LE
i32 / u324 bytes LE
i64 / u648 bytes LE
f324 bytes LE
f648 bytes LE
str / String[u32 len][UTF-8 bytes]
Option<T>[tag][payload]
Vec<T>[u32 count][elements...]
structfields in schema order

Binary payloads are not self-describing in the same way as text ASUN. In practice, decoding usually needs:

  • an explicit schema string
  • a target type
  • or a matched field layout on both sides

Interoperability ​

ASUN-BIN is best treated as an implementation-local wire format. If different languages need to communicate, use ASUN text unless you have explicitly matched binary implementations.

Released under the MIT License.