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
Remove one writer alloc
#430
Closed
wcampbell0x2a
closed
6 months ago
wcampbell0x2a
commented
7 months ago
Remove allocation and force bit.len() < MAX_BITS_AMT like reader does
Speed up deku_write_bits by 20% on my machine
github-actions[bot]
commented
7 months ago
Benchmark for 3739f19
Click to view benchmark
| Test | Base | PR | % | |------|--------------|------------------|---| | deku_read_bits | **1295.0±15.77ns** | 1312.4±11.43ns | **+1.34%** | | deku_read_byte | 5.2±0.09ns | 5.2±0.22ns | 0.00% | | deku_read_enum | 2.5±0.07ns | 2.5±0.07ns | 0.00% | | deku_read_vec | 35.6±0.82ns | 35.4±0.32ns | -0.56% | | deku_write_bits | 186.9±5.06ns | **157.3±3.62ns** | **-15.84%** | | deku_write_byte | **22.3±0.42ns** | 22.7±0.36ns | **+1.79%** | | deku_write_enum | **20.8±0.34ns** | 21.1±0.21ns | **+1.44%** | | deku_write_vec | 325.0±2.49ns | **306.7±4.58ns** | **-5.63%** |
github-actions[bot]
commented
7 months ago
Benchmark for e35d91b
Click to view benchmark
| Test | Base | PR | % | |------|--------------|------------------|---| | deku_read_bits | 1281.1±11.27ns | 1282.6±41.56ns | +0.12% | | deku_read_byte | **5.2±0.04ns** | 15.9±0.02ns | **+205.77%** | | deku_read_enum | **2.5±0.07ns** | 15.5±0.05ns | **+520.00%** | | deku_read_vec | **35.3±0.44ns** | 44.6±1.82ns | **+26.35%** | | deku_write_bits | 183.9±3.76ns | **156.5±3.05ns** | **-14.90%** | | deku_write_byte | 22.4±0.42ns | 22.6±0.49ns | +0.89% | | deku_write_enum | **20.8±0.29ns** | 21.6±2.21ns | **+3.85%** | | deku_write_vec | **295.6±4.91ns** | 306.8±6.20ns | **+3.79%** |
wcampbell0x2a
commented
6 months ago
@sharksforarms another rebase!
github-actions[bot]
commented
6 months ago
Benchmark for 46df092
Click to view benchmark
| Test | Base | PR | % | |------|--------------|------------------|---| | deku_read_bits | 1191.5±12.81ns | **1174.7±20.79ns** | **-1.41%** | | deku_read_byte | 5.2±0.09ns | 5.2±0.12ns | 0.00% | | deku_read_enum | 2.6±0.08ns | 2.6±0.10ns | 0.00% | | deku_read_vec | 35.6±0.42ns | **35.1±0.71ns** | **-1.40%** | | deku_write_bits | 197.1±6.44ns | **157.3±3.56ns** | **-20.19%** | | deku_write_byte | 22.3±0.38ns | **22.0±0.26ns** | **-1.35%** | | deku_write_enum | 23.7±0.82ns | 23.6±0.53ns | -0.42% | | deku_write_vec | 318.2±4.26ns | **287.3±2.51ns** | **-9.71%** |