3 ms·
Rust traits do not require dynamic dispatch nor a jump table. Therefore rust traits are inherently faster than zig unions. They can be used via dynamic dispatc
by mahkoh 4y ago
Rust traits do not require dynamic dispatch nor a jump table. Therefore rust traits are inherently faster than zig unions.
They can be used via dynamic dispatch but this is not the default.
- anonymoushn 4y agoYou just wouldn't use a union if you wanted monomorphization and didn't want e.g. a heterogeneous collection. Even when it is possible, "monomorphize everything" isn't always faster though, because for example ITLBs are not infinitely large.