1 unstable release

0.2.0 Aug 25, 2024
0.1.0 Aug 23, 2024

#868 in Data structures

MIT/Apache

29KB
629 lines

byteview

CI CI docs.rs Crates.io MSRV

An immutable byte slice that may be inlined, and can be partially cloned without heap allocation.

Memory layout

Memory usage

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 500k "helloworld".repeat(1000) (len=10'000) strings:

Struct Memory Usage
Arc<[u8]> 5 GB
tokio::Bytes 5 GB
ByteView 5 GB

Dependencies

~160KB