mirror of
https://github.com/loro-dev/loro.git
synced 2025-01-23 21:43:59 +00:00
13 lines
522 B
Rust
13 lines
522 B
Rust
|
use compact_bytes::CompactBytes;
|
||
|
|
||
|
pub fn main() {
|
||
|
let data = include_str!("../benches/permuted.mht");
|
||
|
// this simulate the situation in loro snapshot encoding,
|
||
|
// where we first encode the state snapshot, then we look up the slices of the ops.
|
||
|
let mut bytes = CompactBytes::new();
|
||
|
bytes.append(&data.as_bytes()[..data.len() / 2]);
|
||
|
println!("{}", bytes.as_bytes().len()); // 114275
|
||
|
bytes.alloc_advance(&data.as_bytes()[data.len() / 2..]);
|
||
|
println!("{}", bytes.as_bytes().len()); // 117026
|
||
|
}
|