3 ms·
It seems that you can work around this by allocating every field separately. This is obviously going to perform worse but I don't think it would actually violat
by kevincox 3y ago
It seems that you can work around this by allocating every field separately. This is obviously going to perform worse but I don't think it would actually violate the language behaviour (other than maybe assumptions using unsafe memory access). Combined with some whole-program analysis to see which fields ever have their address taken this could even be a relatively small performance hit. (Although I think this whole-program analysis would fail in the face of reflection.)
Depending on how much code you want to run it may be interesting to be able to decide between shipping a GC implementation and slowing down your code to avoid it. If it is an extra 50% code size on top of a fairly small amount of first-party code you may pick WasmGC.