Use u8 for TLV type when writing and reading our own structs
Once inlined, a very nontrivial portion of the total code generated
for reading TLVs is BigSize deserialization. In some naive testing,
as much as 50% of total code size is dedicated to the combination
of type and length deserialization.
While we're stuck with BigSize deserialization for network messages
there is nothing requiring we use BigSizes for our own messages,
and specifically for types, unless we have > 127
required/non-required types the serialization format remains the
same.
Thus, we adapt our TLV macros to support either BigSize or
U8Wrapper (ie u8 with a wrapper to make it API-compatible with
BigSize) for types depending on the context.
This results in somewhat less code, though a dissapointingly small
performance improvement. Future work, however, can further compact
the deserialization logic by taking advantage of known lengths per
type.
As of this commit, on an Intel 2687W v3, the serialization
benchmarks take:
test routing::network_graph::benches::read_network_graph ... bench: 1,962,012,392 ns/iter (+/- 2,391,402)
test routing::network_graph::benches::write_network_graph ... bench: 166,772,461 ns/iter (+/- 295,302)