-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve low level struct performance #46104
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
What about...?
Which is sorta struct Obj5
{
object o0;
object o1;
object o2;
object o3;
object o4;
}
Obj5 objs = default;
Span<object> span = CreateSpan(ref objs.o0, 5); |
The |
struct <Buffer>e__FixedBuffer_1024<T>
{
private T _e0;
private T _e1;
// _e2 ... _e1023
private T _e1024;
public ref T this[int index] => ref (uint)index <= 1024u ?
ref RefAdd<T>(ref _e0, index):
} Not sure what the GC would make of referring only to an internal element of a stack struct (if it was sliced) |
I think #25423 is the proposal we should follow to improve stackalloc. |
@jaredpar this is unlikely for 6 due to statics in interfaces work. Ok to move out? |
Moving this to future, since this is moved out of .net 6. |
Fore reference #38743 |
This is a "User Story" to track the proposed improvements to low level struct performance improvements.
C# Language Features
ref
fields inref struct
types allow references to structs to be stored in fields of ref structs csharplang#1147The feature proposal for both C# features is captured here
Related Runtime Requests:
ref
fields inref struct
Allow ref struct to contain ref fields #32060FixedSizBufferAttribute
proposal Expose an attribute to allow sizing a fixed sized buffer based on type and element count. #12320The text was updated successfully, but these errors were encountered: