You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rust currently imposes overhead on all compiled code to accommodate managed pointers and will need to continue doing so to some extent for a real garbage collector. Trait objects and closures are opaque, and may contain garbage collected boxes. Support for correctly rooting references may involve overhead even for unique pointers without managed data inside.
closures currently have a 4-word header which is unnecessary
procs currently have a 4-word header including a TyDesc, which should just be a destructor pointer
&Trait has a TyDesc, which is unnecessary
~Trait has a TyDesc, which should just be a destructor pointer
free glue is unnecessary, and should just be drop glue
take glue is unnecessary
any future support for tracing (shadow stack, references inside unique pointers, etc.) should be entirely disabled
The text was updated successfully, but these errors were encountered:
I suggest replacing the vtable pointer for &Trait/&mut Trait with a function pointer where there is only one method callable through the trait object - that way &Fn/&mut FnMut trait objects will be compatible with the current closure representation (well, not for backwards compatibility's sake, but to avoid a pointless indirect access).
#12059 finishes off the TyDescs as @pnkfelix and @pcwalton did not consider them necessary for garbage collection (can use side tables)
I'll just keep a careful eye on future changes and open a bug if and when there's any new overhead there should be an opt-out from. There's not much point having a bug for a presumed future issue.
Rust currently imposes overhead on all compiled code to accommodate managed pointers and will need to continue doing so to some extent for a real garbage collector. Trait objects and closures are opaque, and may contain garbage collected boxes. Support for correctly rooting references may involve overhead even for unique pointers without managed data inside.
including aTyDesc
, which should just be a destructor pointer&Trait
has aTyDesc
, which is unnecessary~Trait
has aTyDesc
, which should just be a destructor pointerfree glue is unnecessary, and should just be drop gluetake glue is unnecessaryThe text was updated successfully, but these errors were encountered: