1
0
Fork 0
mirror of https://codeberg.org/icewind/bitbuffer.git synced 2026-06-03 08:34:07 +02:00

drop read_*_into for now as it doesn't seem to help much for the complexity

This commit is contained in:
Robin Appelman 2025-07-14 20:06:45 +02:00
commit a07123315c
4 changed files with 13 additions and 350 deletions

View file

@ -121,26 +121,6 @@ fn perf_string<E: Endianness>((offset, buffer): (usize, BitReadBuffer<E>)) {
}
}
#[library_benchmark(setup = build_string_buffer)]
#[bench::le_alligned(0, LittleEndian)]
#[bench::be_alligned(0, BigEndian)]
#[bench::le_unalligned(3, LittleEndian)]
#[bench::be_unalligned(3, BigEndian)]
fn perf_string_into<E: Endianness>((offset, buffer): (usize, BitReadBuffer<E>)) {
let mut pos = offset;
let len = buffer.bit_len();
let mut buff = String::new();
loop {
if pos + (128 * 8) > len {
break;
}
let result = buffer.read_string_into(pos, None, &mut buff).unwrap();
let result = result.as_ref(&buff);
pos += (result.len() + 1) * 8;
black_box(result);
}
}
#[library_benchmark(setup = build_string_buffer)]
#[bench::le_alligned(0, LittleEndian)]
#[bench::be_alligned(0, BigEndian)]
@ -159,26 +139,6 @@ fn perf_bytes<E: Endianness>((offset, buffer): (usize, BitReadBuffer<E>)) {
}
}
#[library_benchmark(setup = build_string_buffer)]
#[bench::le_alligned(0, LittleEndian)]
#[bench::be_alligned(0, BigEndian)]
#[bench::le_unalligned(3, LittleEndian)]
#[bench::be_unalligned(3, BigEndian)]
fn perf_bytes_into<E: Endianness>((offset, buffer): (usize, BitReadBuffer<E>)) {
let mut pos = offset;
let len = buffer.bit_len();
let mut buff = Vec::new();
loop {
if pos + (128 * 8) > len {
break;
}
let result = buffer.read_bytes_into(pos, 128, &mut buff).unwrap();
let result = result.as_ref(&buff);
pos += (result.len() + 1) * 8;
black_box(result);
}
}
#[allow(dead_code)]
#[derive(BitRead)]
struct BasicStruct {
@ -230,14 +190,12 @@ library_benchmark_group!(
library_benchmark_group!(
name = bench_read_string;
compare_by_id = true;
benchmarks = perf_string, perf_string_into
benchmarks = perf_string
);
library_benchmark_group!(
name = bench_read_bytes;
compare_by_id = true;
benchmarks = perf_bytes, perf_bytes_into
benchmarks = perf_bytes
);
library_benchmark_group!(