greglook / clj-cbor

Native Clojure CBOR codec implementation.
The Unlicense
70 stars 7 forks source link

Test out jump-table decoder approach #9

Closed greglook closed 5 years ago

greglook commented 6 years ago

Given that many values are entirely determined by the first byte of each data item, the codec could take a more direct approach to decoding values by using a jump table instead of the normal branching logic. This would have 256 entries, which return hard-coded values where possible and dispatches to the more nuanced decoding functions elsewhere. Using a case would give constant-time decoding for all single-byte values.

See RFC 7049 Appendix B

greglook commented 5 years ago

Addressed in #11.