sharksforarms / deku

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

Allow lit attributes #394

Closed wcampbell0x2a closed 6 months ago

wcampbell0x2a commented 6 months ago

Working on deku, and I was thinking "the usage " around id is kinda weird? surely we can support not doing this". And this patch does that. I don't know if there is a philosophical reason for all the "? I prefer it not existing, and this patch just allows it to not and exist at the same time.

I went to make the same changes to bytes and bits and low and behold this was already allowed! I changed all references and removed the " from them.

github-actions[bot] commented 6 months ago

Benchmark for 2ecc2d5

Click to view benchmark | Test | Base | PR | % | |------|--------------|------------------|---| | deku_read_bits | 1173.8±17.34ns | **1119.8±11.77ns** | **-4.60%** | | deku_read_byte | 19.3±0.26ns | 19.3±0.24ns | 0.00% | | deku_read_enum | 9.3±0.06ns | 9.3±0.15ns | 0.00% | | deku_read_vec | 53.7±0.62ns | 53.7±1.00ns | 0.00% | | deku_write_bits | 113.2±2.13ns | 114.3±2.27ns | +0.97% | | deku_write_byte | 122.0±2.86ns | 124.5±4.02ns | +2.05% | | deku_write_enum | 87.0±5.53ns | 88.4±4.89ns | +1.61% | | deku_write_vec | 3.0±0.03µs | 3.0±0.05µs | 0.00% |