You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Binary notation: self-referencing links take 3 bytes, the spec says 2 #51
Both encoders write 3 bytes instead: the type, the id, and then the shared source/target again.
Reproduction (at bdc7631)
import{BinaryNotation,HEADER_SIZE}from'./js/src/protocol/binary-notation.js';constbody=BinaryNotation.encode({id: 5,source: 5,target: 5}).slice(HEADER_SIZE+1);console.log(Buffer.from(body).toString('hex'));// 0f0505, the spec says 0f05
The Rust encoder does the same: encode_link_body in rust/src/backends/binary_notation.rs writes the id when link.id.is_some(), then, for is_self_ref, writes source_id again.
Expected
Either the encoders and decoders follow the spec (when SELF_REF and HAS_ID are both set and the id equals the source, write the id only, saving one varint per point link — a store of 1000 points (i: i i) takes 4759 bytes today), or the spec's example is corrected to 0F 05 05, 3 bytes. Changing the encoding is a wire-format change, so the decoder and the spec version would need to move together.
A smaller point in the same example: (5: 5 5) is 8 bytes of text, not 10.
Activity