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
The FutureState type in std.sync is a heap type, meaning that it also includes a header. The way it's used is such that we never make use of that header, resulting in 16 bytes of wasted space per FutureState.
Now that we have support for inline types we can optimize this as follows:
We make FutureState an inline type
We allocate it using std.ptr.resize
Instead of a UInt64 that we cast to an owned value and then forget about, we use a Pointer[FutureState] and access the fields through that pointer
This will probably require some manual fiddling with pointer offsets for e.g. access to the atomic state
The tricky thing/downside is that we'd depend on FutureState having a specific layout. While this is currently true, it's not something that we guarantee. We can't use an extern type as these can't be generic.
The text was updated successfully, but these errors were encountered:
The
FutureState
type instd.sync
is a heap type, meaning that it also includes a header. The way it's used is such that we never make use of that header, resulting in 16 bytes of wasted space perFutureState
.Now that we have support for
inline
types we can optimize this as follows:FutureState
an inline typestd.ptr.resize
UInt64
that we cast to an owned value and then forget about, we use aPointer[FutureState]
and access the fields through that pointerThis will probably require some manual fiddling with pointer offsets for e.g. access to the atomic state
The tricky thing/downside is that we'd depend on
FutureState
having a specific layout. While this is currently true, it's not something that we guarantee. We can't use anextern
type as these can't be generic.The text was updated successfully, but these errors were encountered: