Byteview
Thin immutable zero-copy byte slice
Install / Use
/learn @fjall-rs/ByteviewREADME
byteview
An immutable byte slice that may be inlined, and can be partially cloned without heap allocation.
Think of it as a specialized Arc<[u8]> that can be inlined (skip allocation for small values) and no weak count.

byteview was originally designed to speed up deserialization in lsm-tree, allow inlining of small values and reduce memory usage compared to Arc'd slices.
Values with a known length can be constructed 2-2.5x faster than using Arc<[u8]>:

Sponsors
<a href="https://sqlsync.dev"> <picture> <source width="240" alt="Orbitinghail" media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/fjall-rs/fjall-rs.github.io/d22fcb1e6966ce08327ea3bf6cf2ea86a840b071/public/logos/orbitinghail.svg" /> <source width="240" alt="Orbitinghail" media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/fjall-rs/fjall-rs.github.io/d22fcb1e6966ce08327ea3bf6cf2ea86a840b071/public/logos/orbitinghail_dark.svg" /> <img width="240" alt="Orbitinghail" src="https://raw.githubusercontent.com/fjall-rs/fjall-rs.github.io/d22fcb1e6966ce08327ea3bf6cf2ea86a840b071/public/logos/orbitinghail_dark.svg" /> </picture> </a>Memory usage
Allocating 200M "" (len=0) strings:
| Struct | Memory Usage |
|-----------------|--------------|
| Arc<[u8]> | 9.6 GB |
| tokio::Bytes | 6.4 GB |
| ByteView | 4.8 GB |
Allocating 200M "helloworld" (len=10) strings:
| Struct | Memory Usage |
|-----------------|--------------|
| Arc<[u8]> | 12.8 GB |
| tokio::Bytes | 12.8 GB |
| ByteView | 4.8 GB |
Allocating 100M "helloworldhelloworld" (len=20) strings:
| Struct | Memory Usage |
|-----------------|--------------|
| Arc<[u8]> | 6.4 GB |
| tokio::Bytes | 6.4 GB |
| ByteView | 2.4 GB |
Allocating 50M "helloworldhelloworldhelloworldhelloworld" (len=30) strings:
| Struct | Memory Usage |
|-----------------|--------------|
| Arc<[u8]> | 4.0 GB |
| tokio::Bytes | 4.0 GB |
| ByteView | 3.6 GB |
Allocating 500k "helloworld".repeat(1000) (len=10'000) strings:
| Struct | Memory Usage |
|-----------------|--------------|
| Arc<[u8]> | 5 GB |
| tokio::Bytes | 5 GB |
| ByteView | 5 GB |
Run fuzz tests
cargo +nightly fuzz run fuzz_target_1
Related Skills
node-connect
343.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
92.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
