3 ms·
You do, however, double the size of your data type. A struct { enum; u64 } is going to be 128-bits vs struct { is_int: u1; int_value: u63; } at 64-bits. This ca
by messe 3y ago
You do, however, double the size of your data type. A struct { enum; u64 } is going to be 128-bits vs struct { is_int: u1; int_value: u63; } at 64-bits. This can make a huge difference in performance critical code, as you double the rate of cache misses.
- Joker_vD 3y agoNot to mention that now you need 2 registers instead of 1 to hold it, so now stack spilling happens in 80% of functions instead of 5% (numbers invented, but really: 5 alive values taking 5 registers vs 10 is a huge difference). And don't forget about argument passing: argument-passing registers are almost definitely has to be spilled now, and there is almost mever enough of those, so now arguments too have to be spilled on the stack... this is a horrible way to represent data.