Closed emhane closed 2 months ago
*type is only 8 bytes
oops, yeah. I misunderstood something, sorry.
Then, it'd be reasonable to implement ReservedValue
for type.
thought so, based on the explanation. thanks for the explanation.
Hmm, but I still think using Option<Type>
could be slightly better. The reason is that Rust applies null pointer optimization, meaning that if Type
does not utilize all possible bit patterns, the size of Option<Type>
can remain 8 bytes, just like Type
. From a performance perspective, just using Option<Type>
would be slightly better. However, the performance difference is likely very minor, especially if Option<Type>/PackedOption<Type>
is not used frequently. So it'd be fine as is, I think.
Hmm, but I still think using
Option<Type>
could be slightly better. The reason is that Rust applies null pointer optimization, meaning that ifType
does not utilize all possible bit patterns, the size ofOption<Type>
can remain 8 bytes, just likeType
. From a performance perspective, just usingOption<Type>
would be slightly better. However, the performance difference is likely very minor, especially ifOption<Type>/PackedOption<Type>
is not used frequently. So it'd be fine as is, I think.
ah, I see, because variant Type::Compound(u32)
, actually only needs 5 bytes. https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=803c11e6ccc6789c7ffa2291e53e43f9.
we probably should revert this pr.
Implements
cranelift_entity::ReservedValue
forType
, to use asPackedOption