Crates.io | byteview |
lib.rs | byteview |
version | |
source | src |
created_at | 2024-08-23 13:29:24.237596+00 |
updated_at | 2025-03-27 03:12:44.992907+00 |
description | Thin, immutable zero-copy slice type |
homepage | |
repository | https://github.com/fjall-rs/byteview |
max_upload_size | |
id | 1349159 |
Cargo.toml error: | TOML parse error at line 24, column 1 | 24 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
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 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]>
:
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 |
cargo +nightly fuzz run fuzz_target_1