Skip to content
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

Use static property with aggressive inlining instead of field to save memory #23

Open
Konard opened this issue Oct 26, 2019 · 2 comments
Labels
question Further information is requested

Comments

@Konard
Copy link
Member

Konard commented Oct 26, 2019

public static readonly Range<sbyte> SByte = new Range<sbyte>(sbyte.MinValue, sbyte.MaxValue);

@uselessgoddess
Copy link
Member

It is?

[MethodImpl(MethodImplOptions.AggressiveInlining)]

@Konard
Copy link
Member Author

Konard commented Jul 27, 2021

Yes, the idea is not to store these ranges to save memory. We can try to use inlined property methods instead. But on the other hand, stored version might still be faster to access.
We need a benchmark to decide does [MethodImpl(MethodImplOptions.AggressiveInlining)] help to get the copy of the structure using constructor from inlined property method faster than access to the field.

@Konard Konard added the question Further information is requested label Jul 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants