sharksforarms / deku

Declarative binary reading and writing: bit-level, symmetric, serialization/deserialization
Apache License 2.0
1.05k stars 54 forks source link

Reduce code for u8 byte read #342

Closed wcampbell0x2a closed 10 months ago

wcampbell0x2a commented 1 year ago

I think I was a bit over-eager with the fix within https://github.com/sharksforarms/deku/pull/294.

The following pasts test. unless you can come up with a test that doesn't pass!

github-actions[bot] commented 1 year ago

Benchmark for 2a98e11

Click to view benchmark | Test | Base | PR | % | |------|--------------|------------------|---| | deku_read_bits | 701.3±5.97ns | **694.4±0.47ns** | **-0.98%** | | deku_read_byte | 19.9±0.09ns | **12.4±0.06ns** | **-37.69%** | | deku_read_enum | 35.6±0.16ns | **20.0±0.07ns** | **-43.82%** | | deku_read_vec | 1696.8±3.75ns | **954.2±4.92ns** | **-43.76%** | | deku_read_vec_perf | 1665.4±1.08ns | **940.0±8.47ns** | **-43.56%** | | deku_write_bits | **130.6±0.08ns** | 131.0±0.13ns | **+0.31%** | | deku_write_byte | 74.4±0.45ns | **71.9±0.91ns** | **-3.36%** | | deku_write_enum | 126.5±0.82ns | **120.8±0.62ns** | **-4.51%** | | deku_write_vec | 5.7±0.01µs | **5.4±0.00µs** | **-5.26%** | | deku_write_vec_perf | 5.8±0.00µs | **5.4±0.01µs** | **-6.90%** |