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
Currently we represent a sum as a struct with a u32 tag field and a field for each variant. Each variant field of the sum struct is a struct with a field per variant field. For example, a bool is {u32, {}, {}}, a int + float is {u32, {i64}, {f64}}. The tag field is elided for sums of a single variant. This is all implemented in sum.rs and the rest of the codebase SHOULD be agnostic as to the representation.
There are three avenues of optimisation:
Elide empty structs, elide the struct wrapper of single-field-variants, elide the outer sum struct when all variants are empty
Use the minimum-possible width for the tag field. in particular, for bool this is i1. and together with the previous optimisation, this makes the representation of bool i1.
We store all of the possible variants, with the unused ones poison. Instead, store a byte array of the length of the longest variant
The text was updated successfully, but these errors were encountered:
Currently we represent a sum as a struct with a u32 tag field and a field for each variant. Each variant field of the sum struct is a struct with a field per variant field. For example, a bool is
{u32, {}, {}}
, aint + float
is{u32, {i64}, {f64}}
. The tag field is elided for sums of a single variant. This is all implemented insum.rs
and the rest of the codebase SHOULD be agnostic as to the representation.There are three avenues of optimisation:
The text was updated successfully, but these errors were encountered: