Use an u8 for the tag of enums with up to 255 constructors #807
Labels
compiler
Changes related to the compiler
feature
New things to add to Inko, such as a new standard library module
performance
Changes related to improving performance
Description
The tag of an enum is now a u16, regardless of how many constructors there are. Most enums will have less than 255 constructors such that we can use a u8 instead in those cases. This in turn can be beneficial when storing an enum into another type, as depending on the order/padding of fields this can conserve space. One example is the
FutureState
type (see also #806).We should change the compiler such that tags are lowered to a
u8
if the enum has at most 255 constructors.Related work
No response
The text was updated successfully, but these errors were encountered: