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
Summary
Currently in C# there is a BitVector32() struct on stack and a BitArray() dynamic heap. Developers have had to manually create their own data structures for 64-bit and to enhance the properties and methods. Can you make a 64-bit and 128-bit (or maybe dynamically chooses native bit of the box) version of BitVector or a BitArray that works on the stack? Could AMD help with making optimizations to AMD chips?
Motivation
GOAL 1- Can there be speed ups of existing code so that the compiler detects non-fancy coding (maybe of Boolean or integer or short character segments) and chooses to use this new struct under the hood? (This could be a way to improve performance of C# compared to other languages.)
GOAL 2- Improve properties and methods especially in non-bit specific ways (meaning BitVector32 wants you to interact with it with only masks)
GOAL 3- Do this as struct if we know it is static length and within the size.
GOAL 4 - Perhaps use the new Span functionality to improve performance.
GOAL 5 - Low priority - Perhaps work with chip makers (such as AMD) to improve performance.
GOAL 6 - Very low priority - Perhaps this would help porting C++ code that has bit operations on 64-bit to C#.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Summary
Currently in C# there is a BitVector32() struct on stack and a BitArray() dynamic heap. Developers have had to manually create their own data structures for 64-bit and to enhance the properties and methods. Can you make a 64-bit and 128-bit (or maybe dynamically chooses native bit of the box) version of BitVector or a BitArray that works on the stack? Could AMD help with making optimizations to AMD chips?
Motivation
GOAL 1- Can there be speed ups of existing code so that the compiler detects non-fancy coding (maybe of Boolean or integer or short character segments) and chooses to use this new struct under the hood? (This could be a way to improve performance of C# compared to other languages.)
GOAL 2- Improve properties and methods especially in non-bit specific ways (meaning BitVector32 wants you to interact with it with only masks)
GOAL 3- Do this as struct if we know it is static length and within the size.
GOAL 4 - Perhaps use the new Span functionality to improve performance.
GOAL 5 - Low priority - Perhaps work with chip makers (such as AMD) to improve performance.
GOAL 6 - Very low priority - Perhaps this would help porting C++ code that has bit operations on 64-bit to C#.
Planning
I like some of the properties and methods found under the BigInteger:
https://learn.microsoft.com/en-us/dotnet/api/system.numerics.biginteger?view=net-8.0
I like his commentary of what are issues with BitVector32 and BitArray. Also he attempts to fix it.:
https://www.jacksondunstan.com/articles/5126
Here is another developer adding the BitVector64:
https://www.codeproject.com/Tips/838362/A-bit-Bit-Field-in-Csharp
I suggest glancing at other vendors that do something similar:
Unity.Collections has NativeBitArray, BitField32, BitField64
Perhaps it could be implemented under the hood with hardware intrinsics such as Vector128 or whatever.
Beta Was this translation helpful? Give feedback.
All reactions