issues
search
sharksforarms
/
deku
Declarative binary reading and writing: bit-level, symmetric, serialization/deserialization
Apache License 2.0
1.14k
stars
55
forks
source link
Add count Vec<u8> Specializations
#481
Closed
wcampbell0x2a
closed
1 month ago
wcampbell0x2a
commented
2 months ago
For Vec
when using count, specialize into reading the bytes all at once
See #462
github-actions[bot]
commented
2 months ago
Benchmark for 88e3bbc
Click to view benchmark
| Test | Base | PR | % | |------|--------------|------------------|---| | count | 5.1±0.02µs | **5.0±0.01µs** | **-1.96%** | | deku_read_bits | **1180.2±16.27ns** | 1208.0±17.87ns | **+2.36%** | | deku_read_byte | 5.8±0.08ns | 5.8±0.04ns | 0.00% | | deku_read_enum | 5.3±0.13ns | **5.2±0.05ns** | **-1.89%** | | deku_read_vec | 42.6±0.35ns | 42.6±0.22ns | 0.00% | | deku_write_bits | 185.6±3.56ns | **170.0±2.39ns** | **-8.41%** | | deku_write_byte | 24.9±0.52ns | **24.6±0.29ns** | **-1.20%** | | deku_write_enum | **22.6±0.35ns** | 23.0±0.47ns | **+1.77%** | | deku_write_vec | **423.8±3.75ns** | 437.0±10.41ns | **+3.11%** | | read_all | 5.5±0.07µs | 5.5±0.02µs | 0.00% | | read_all_bytes | 5.6±0.04µs | 5.6±0.05µs | 0.00% | | read_exact | 97.4±1.49ns | N/A | N/A |
github-actions[bot]
commented
2 months ago
Benchmark for 78781ca
Click to view benchmark
| Test | Base | PR | % | |------|--------------|------------------|---| | count | **5.0±0.02µs** | 5.1±0.02µs | **+2.00%** | | deku_read_bits | 1165.9±11.41ns | **1130.9±16.18ns** | **-3.00%** | | deku_read_byte | 5.9±0.04ns | 5.9±0.09ns | 0.00% | | deku_read_enum | 4.7±0.04ns | 4.7±0.03ns | 0.00% | | deku_read_vec | 42.5±0.36ns | 42.5±0.24ns | 0.00% | | deku_write_bits | 186.4±3.90ns | **169.7±1.77ns** | **-8.96%** | | deku_write_byte | 25.0±0.31ns | **24.7±0.25ns** | **-1.20%** | | deku_write_enum | 22.8±0.34ns | 23.1±0.51ns | +1.32% | | deku_write_vec | **412.7±4.85ns** | 418.4±8.71ns | **+1.38%** | | read_all | 3.9±0.55µs | **3.8±0.03µs** | **-2.56%** | | read_all_bytes | 3.8±0.07µs | 3.8±0.05µs | 0.00% | | read_exact | 99.0±0.93ns | N/A | N/A |
github-actions[bot]
commented
2 months ago
Benchmark for 3149e3f
Click to view benchmark
| Test | Base | PR | % | |------|--------------|------------------|---| | count | 5.1±0.02µs | N/A | N/A | | count_from_u8_specialize | 96.4±1.09ns | N/A | N/A | | count_no_specialize | 2.4±0.03µs | N/A | N/A | | count_specialize | 96.0±1.02ns | N/A | N/A | | deku_read_bits | 1185.3±14.65ns | 1196.7±16.53ns | +0.96% | | deku_read_byte | **5.3±0.07ns** | 5.9±0.09ns | **+11.32%** | | deku_read_enum | **4.5±0.11ns** | 4.7±0.04ns | **+4.44%** | | deku_read_vec | 42.5±0.46ns | **30.4±0.78ns** | **-28.47%** | | deku_write_bits | 186.5±1.46ns | **184.7±7.33ns** | **-0.97%** | | deku_write_byte | 25.1±1.05ns | 25.0±0.36ns | -0.40% | | deku_write_enum | 22.8±0.41ns | 22.9±0.79ns | +0.44% | | deku_write_vec | 427.4±5.02ns | **415.6±7.32ns** | **-2.76%** | | read_all | 5.7±0.03µs | **3.7±0.02µs** | **-35.09%** | | read_all_bytes | 5.7±0.02µs | **4.0±0.22µs** | **-29.82%** |
github-actions[bot]
commented
2 months ago
Benchmark for 079a65c
Click to view benchmark
| Test | Base | PR | % | |------|--------------|------------------|---| | count | 5.0±0.02µs | N/A | N/A | | count_from_u8_specialize | 99.9±0.58ns | N/A | N/A | | count_no_specialize | 2.4±0.03µs | N/A | N/A | | count_specialize | 96.6±0.90ns | N/A | N/A | | deku_read_bits | **1166.0±14.69ns** | 1202.0±26.40ns | **+3.09%** | | deku_read_byte | 5.9±0.05ns | 5.9±0.02ns | 0.00% | | deku_read_enum | 4.7±0.06ns | 4.7±0.10ns | 0.00% | | deku_read_vec | 42.8±0.58ns | **30.3±0.33ns** | **-29.21%** | | deku_write_bits | 186.6±4.89ns | 185.8±6.89ns | -0.43% | | deku_write_byte | 25.0±0.34ns | 25.2±1.18ns | +0.80% | | deku_write_enum | 22.9±1.28ns | 22.8±0.28ns | -0.44% | | deku_write_vec | **403.4±6.66ns** | 423.1±7.59ns | **+4.88%** | | read_all | **3.8±0.09µs** | 3.9±0.03µs | **+2.63%** | | read_all_bytes | 3.8±0.05µs | 3.8±0.05µs | 0.00% |
github-actions[bot]
commented
2 months ago
Benchmark for 7fcef63
Click to view benchmark
| Test | Base | PR | % | |------|--------------|------------------|---| | count | 5.0±0.03µs | N/A | N/A | | count_from_u8_specialize | 89.7±1.33ns | N/A | N/A | | count_no_specialize | 2.7±0.02µs | N/A | N/A | | count_specialize | 97.9±2.97ns | N/A | N/A | | deku_read_bits | **1166.6±19.82ns** | 1197.2±13.91ns | **+2.62%** | | deku_read_byte | 5.3±0.04ns | 5.3±0.08ns | 0.00% | | deku_read_enum | 4.5±0.05ns | **4.4±0.06ns** | **-2.22%** | | deku_read_vec | 42.5±0.30ns | **30.4±0.60ns** | **-28.47%** | | deku_write_bits | 187.8±4.02ns | 185.1±7.55ns | -1.44% | | deku_write_byte | 25.0±0.45ns | 25.1±0.57ns | +0.40% | | deku_write_enum | 22.8±0.58ns | 22.8±0.20ns | 0.00% | | deku_write_vec | **409.2±6.31ns** | 430.3±6.83ns | **+5.16%** | | read_all | **5.6±0.04µs** | 6.5±0.03µs | **+16.07%** | | read_all_bytes | 5.6±0.04µs | 5.6±0.04µs | 0.00% |
github-actions[bot]
commented
2 months ago
Benchmark for b0370d3
Click to view benchmark
| Test | Base | PR | % | |------|--------------|------------------|---| | count | 5.0±0.01µs | N/A | N/A | | count_from_u8_specialize | 99.1±1.12ns | N/A | N/A | | count_no_specialize | 2.4±0.02µs | N/A | N/A | | count_specialize | 94.3±0.97ns | N/A | N/A | | deku_read_bits | **1188.8±6.48ns** | 1217.7±35.32ns | **+2.43%** | | deku_read_byte | 5.9±0.03ns | 5.9±0.11ns | 0.00% | | deku_read_enum | 4.7±0.05ns | 4.7±0.05ns | 0.00% | | deku_read_vec | 42.8±0.30ns | **30.3±0.57ns** | **-29.21%** | | deku_write_bits | 195.6±2.25ns | **185.0±5.83ns** | **-5.42%** | | deku_write_byte | 25.0±0.42ns | 25.0±0.23ns | 0.00% | | deku_write_enum | 22.7±0.26ns | 22.8±0.62ns | +0.44% | | deku_write_vec | **425.6±3.79ns** | 434.8±7.41ns | **+2.16%** | | read_all | 3.8±0.05µs | 3.8±0.05µs | 0.00% | | read_all_bytes | 3.8±0.03µs | 3.8±0.06µs | 0.00% |
See #462