FuelLabs / sway

🌴 Empowering everyone to build reliable and efficient smart contracts.
https://docs.fuel.network/docs/sway/
Apache License 2.0
62.76k stars 5.36k forks source link

Support configurable memory layouts of aggregates #5286

Open ironcev opened 10 months ago

ironcev commented 10 months ago

The memory layout of Sway types is hardcoded at the moment and tested and documented in irtype.rs. In the case of structs (means also tuples and enums which are the structs of tags and unions) whose fields are smaller then the word, the default padding is not optimal in the sense of memory space usage.

We can think of better packing of structs, again hardcoded, but even go a step further and provide an equivalent to #[repr(...)] in Rust.

ironcev commented 10 months ago

Related to #5227.

Eazibigz commented 10 months ago

Nice idea kind of cross my mind