fjall-rs/byteview

Thin immutable zero-copy byte slice

Rust

75

155 commits

updated Jul 29, 2026

See the code

README

byteview

CI CI docs.rs Crates.io MSRV

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.

Memory layout

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]>:

Constructor benchmark

Sponsors

Orbitinghail

Memory usage

Allocating 200M "" (len=0) strings:

StructMemory Usage
Arc<[u8]>9.6 GB
tokio::Bytes6.4 GB
ByteView4.8 GB

Allocating 200M "helloworld" (len=10) strings:

StructMemory Usage
Arc<[u8]>12.8 GB
tokio::Bytes12.8 GB
ByteView4.8 GB

Allocating 100M "helloworldhelloworld" (len=20) strings:

StructMemory Usage
Arc<[u8]>6.4 GB
tokio::Bytes6.4 GB
ByteView2.4 GB

Allocating 50M "helloworldhelloworldhelloworldhelloworld" (len=30) strings:

StructMemory Usage
Arc<[u8]>4.0 GB
tokio::Bytes4.0 GB
ByteView3.6 GB

Allocating 500k "helloworld".repeat(1000) (len=10'000) strings:

StructMemory Usage
Arc<[u8]>5 GB
tokio::Bytes5 GB
ByteView5 GB

Run fuzz tests

cargo +nightly fuzz run fuzz_target_1

Contributors

marvin-j97

152 commits

renovate[bot]

2 commits

carlsverre

1 commits

fjall-rs/byteview

Thin immutable zero-copy byte slice

Rust

75

155 commits

updated Jul 29, 2026

See the code

README

byteview

CI CI docs.rs Crates.io MSRV

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.

Memory layout

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]>:

Constructor benchmark

Sponsors

Orbitinghail

Memory usage

Allocating 200M "" (len=0) strings:

StructMemory Usage
Arc<[u8]>9.6 GB
tokio::Bytes6.4 GB
ByteView4.8 GB

Allocating 200M "helloworld" (len=10) strings:

StructMemory Usage
Arc<[u8]>12.8 GB
tokio::Bytes12.8 GB
ByteView4.8 GB

Allocating 100M "helloworldhelloworld" (len=20) strings:

StructMemory Usage
Arc<[u8]>6.4 GB
tokio::Bytes6.4 GB
ByteView2.4 GB

Allocating 50M "helloworldhelloworldhelloworldhelloworld" (len=30) strings:

StructMemory Usage
Arc<[u8]>4.0 GB
tokio::Bytes4.0 GB
ByteView3.6 GB

Allocating 500k "helloworld".repeat(1000) (len=10'000) strings:

StructMemory Usage
Arc<[u8]>5 GB
tokio::Bytes5 GB
ByteView5 GB

Run fuzz tests

cargo +nightly fuzz run fuzz_target_1

Contributors

marvin-j97

152 commits

renovate[bot]

2 commits

carlsverre

1 commits

Languages

Rust

100.0%