(c: &mut Criterion)
| 33 | // --- BENCHMARKS --- |
| 34 | |
| 35 | fn bench_writers(c: &mut Criterion) { |
| 36 | let item_count = 100_000; |
| 37 | let data = generate_data(item_count); |
| 38 | let raw_data = &data.data; // For bincode |
| 39 | |
| 40 | println!("Writers Item count: {}", item_count); |
| 41 | |
| 42 | let mut group = c.benchmark_group("Serialization Write"); |
| 43 | group.throughput(Throughput::Bytes((item_count * 1032) as u64)); |
| 44 | |
| 45 | // 1. Baseline: Bincode (Single Threaded) |
| 46 | group.bench_function("bincode_serialize", |b| { |
| 47 | let mut buffer = Vec::new(); |
| 48 | b.iter(|| { |
| 49 | bincode::serde::encode_into_std_write( |
| 50 | black_box(raw_data), |
| 51 | &mut Cursor::new(&mut buffer), |
| 52 | bincode::config::standard(), |
| 53 | ) |
| 54 | .expect("Bincode serialization failed"); |
| 55 | }); |
| 56 | }); |
| 57 | |
| 58 | // 2. Parcode |
| 59 | group.bench_function("parcode_save", |b| { |
| 60 | let mut buffer = Vec::new(); |
| 61 | b.iter(|| { |
| 62 | Parcode::write(&mut buffer, black_box(&data)).expect("Failed to save parcode data"); |
| 63 | }); |
| 64 | }); |
| 65 | |
| 66 | group.finish(); |
| 67 | } |
| 68 | |
| 69 | fn bench_readers(c: &mut Criterion) { |
| 70 | let item_count = 100_000; |
nothing calls this directly
no test coverage detected