| Crates.io | bitio-rs |
| lib.rs | bitio-rs |
| version | 0.1.2 |
| created_at | 2025-07-01 11:12:25.103183+00 |
| updated_at | 2025-07-03 11:27:47.470572+00 |
| description | 🚀A lightweight Rust library for bit-level I/O: read, peek, write, with both big-endian and little-endian support. |
| homepage | |
| repository | https://github.com/F2077/bitio-rs |
| max_upload_size | |
| id | 1733119 |
| size | 111,946 |
🚀A lightweight Rust library for bit-level I/O: read, write, peek, with both big-endian and little-endian support.
Read source (1–64 bits)Write sinkAdd the following to your Cargo.toml:
[dependencies]
bitio-rs = "0.1.2"
See quickstart.rs
Standard BitReader:
BulkBitReader
FastBitReader:
Performance Comparison
Benchmarks measured on Apple M4 (16GB RAM):
| Implementation | Median Time | Relative Speed | Notes |
|---|---|---|---|
| (Standard) BitReader (Big) | 5.3282 μs | Baseline (1.0x) | |
| (Standard) BitReader (Little) | 5.5700 μs | 0.96x | |
| BulkBitReader (Big) | 15.009 μs | 2.82x slower | |
| BulkBitReader (Little) | 15.432 μs | 2.77x slower | |
| FastBitReaderBig | 295.46 ns | 18.0x faster | incompatible API |
| FastBitReaderLittle | 264.06 ns | 21.1x faster | incompatible API |
Performance vs Compatibility Tradeoff: Fast implementations achieve 10-21x speedup but:
- Incompatible API
- Recommended only for performance-critical sections