linksplatform / Ranges

LinksPlatform's Platform.Ranges Class Library
https://linksplatform.github.io/Ranges
The Unlicense
4 stars 1 forks source link

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

Open Konard opened 5 years ago

Konard commented 5 years ago

https://github.com/linksplatform/Ranges/blob/3d716693124f5fccb9cdb786c593d3f61236863d/Range.cs#L13

uselessgoddess commented 3 years ago

It is?

[MethodImpl(MethodImplOptions.AggressiveInlining)]
Konard commented 3 years ago

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.