oxisto / owl2proto

Apache License 2.0
3 stars 0 forks source link

Consistent proto field numbers #3

Closed anatheka closed 1 month ago

anatheka commented 7 months ago

We have somehow to ensure, that the field number does not change at each proto file creation. Furthermore, we have to deal with properties that are added in future.

anatheka commented 7 months ago

We could use non-cryptographic hash functions. We must somehow ensure, that the target number is in a defined range. Either the hash function can do this or we do it via modulo.

anatheka commented 7 months ago

You should use the field numbers 1 through 15 for the most-frequently-set fields. Lower field number values take less space in the wire format. For example, field numbers in the range 1 through 15 take one byte to encode. Field numbers in the range 16 through 2047 take two bytes. You can find out more about this in Protocol Buffer Encoding

(Source: https://protobuf.dev/programming-guides/proto3/#assigning)

oxisto commented 1 month ago

Initial try done by #24