sharksforarms / deku

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

Add bits as an optional feature for bitvec #446

Open wcampbell0x2a opened 1 month ago

wcampbell0x2a commented 1 month ago

This is like the final boss of all my performance work. I try to explain the "no warranty and testing are given for the disable of this feature", while still implementing enough to make this useful in the case of "I want perf to matter".

image

bench: https://github.com/wcampbell0x2a/deku-bench/pull/24

github-actions[bot] commented 1 month ago

Benchmark for 4a76c64

Click to view benchmark | Test | Base | PR | % | |------|--------------|------------------|---| | count | 3.7±0.04µs | N/A | N/A | | deku_read_bits | 1320.4±7.58ns | **1261.2±10.48ns** | **-4.48%** | | deku_read_byte | 3.4±0.22ns | **3.3±0.08ns** | **-2.94%** | | deku_read_enum | **2.6±0.06ns** | 3.0±0.06ns | **+15.38%** | | deku_read_vec | 35.5±2.29ns | 35.2±0.54ns | -0.85% | | deku_write_bits | **149.4±1.91ns** | 168.0±6.70ns | **+12.45%** | | deku_write_byte | 22.0±0.28ns | 21.9±0.29ns | -0.45% | | deku_write_enum | 21.4±0.22ns | 21.4±0.46ns | 0.00% | | deku_write_vec | 387.5±4.44ns | **330.7±5.39ns** | **-14.66%** | | read_all | 4.4±0.18µs | N/A | N/A | | read_all_bytes | 3.9±0.03µs | N/A | N/A |
github-actions[bot] commented 1 month ago

Benchmark for 8947ee1

Click to view benchmark | Test | Base | PR | % | |------|--------------|------------------|---| | count | 3.7±0.04µs | N/A | N/A | | deku_read_bits | 1395.3±21.80ns | **1285.8±42.23ns** | **-7.85%** | | deku_read_byte | 3.3±0.06ns | 3.3±0.05ns | 0.00% | | deku_read_enum | **2.6±0.06ns** | 3.0±0.06ns | **+15.38%** | | deku_read_vec | 35.4±0.51ns | 35.3±0.45ns | -0.28% | | deku_write_bits | 161.1±5.19ns | **146.4±4.32ns** | **-9.12%** | | deku_write_byte | 22.1±0.41ns | 21.8±0.39ns | -1.36% | | deku_write_enum | 21.4±0.23ns | 21.4±0.41ns | 0.00% | | deku_write_vec | 315.0±6.45ns | 313.0±4.11ns | -0.63% | | read_all | 4.4±0.06µs | N/A | N/A | | read_all_bytes | 3.9±0.06µs | N/A | N/A |
github-actions[bot] commented 1 month ago

Benchmark for 755ed48

Click to view benchmark | Test | Base | PR | % | |------|--------------|------------------|---| | count | 3.7±0.03µs | N/A | N/A | | deku_read_bits | 1375.8±19.60ns | **1303.6±38.98ns** | **-5.25%** | | deku_read_byte | 3.5±0.06ns | **3.2±0.04ns** | **-8.57%** | | deku_read_enum | 3.0±0.09ns | **2.6±0.05ns** | **-13.33%** | | deku_read_vec | 38.1±2.11ns | **35.6±0.40ns** | **-6.56%** | | deku_write_bits | **160.4±4.86ns** | 175.5±5.04ns | **+9.41%** | | deku_write_byte | 22.2±0.28ns | **21.8±0.39ns** | **-1.80%** | | deku_write_enum | 21.4±0.19ns | 21.4±0.45ns | 0.00% | | deku_write_vec | **313.3±10.86ns** | 412.2±4.90ns | **+31.57%** | | read_all | 4.2±0.06µs | N/A | N/A | | read_all_bytes | 5.0±0.04µs | N/A | N/A |
github-actions[bot] commented 1 month ago

Benchmark for 6bea42b

Click to view benchmark | Test | Base | PR | % | |------|--------------|------------------|---| | count | 3.7±0.04µs | 3.7±0.03µs | 0.00% | | deku_read_bits | 1273.2±21.85ns | 1285.2±21.64ns | +0.94% | | deku_read_byte | 3.6±0.07ns | **3.2±0.05ns** | **-11.11%** | | deku_read_enum | 3.0±0.04ns | **2.6±0.06ns** | **-13.33%** | | deku_read_vec | 35.7±0.53ns | 35.4±0.60ns | -0.84% | | deku_write_bits | **150.4±2.19ns** | 160.7±6.36ns | **+6.85%** | | deku_write_byte | 21.9±0.41ns | 22.0±0.22ns | +0.46% | | deku_write_enum | 21.4±0.19ns | 21.4±0.37ns | 0.00% | | deku_write_vec | **329.4±4.28ns** | 374.2±4.39ns | **+13.60%** | | read_all | 4.4±0.04µs | **4.2±0.05µs** | **-4.55%** | | read_all_bytes | **3.9±0.05µs** | 5.0±0.03µs | **+28.21%** |