I have a case where a struct has a list of "child" structs, but the list
almost always has a single element. Is there any benefit to using a union
to switch between a list and a single element, like below?
struct Parent {
name: Text;
struct Child {
id :UInt64;
value: Text;
}
union {
child :Child;
children :List(Child);
}
}
The idea is that a single child would take less space, be faster to access,
may be stored in a more compact way if it's small (for some definition of
small), etc. Or is this a pointless exercise because even if there was an
effect it would have been too small to matter?
Cheers,
–CK.
--
You received this message because you are subscribed to the Google Groups
"Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/capnproto.