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
{{ message }}
Repository navigation
Question : What is the most performant way to represent constant System.Runtime.Intrinsics.VectorXXX<T>? #40900
When we want some constant vector,what is the most performant way?
(e.g. static Vector256<int> Stair => Vector256.Create(1,2,3,4,5,6,7,8);, static readonly Vector256<int> Stair = Vector256.Create(1,2,3,4,5,6,7,8);)
I hope it documented on MSDN.
Due to lack of recent activity, this issue has been marked as a candidate for backlog cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.
This issue will now be closed since it had been marked no-recent-activity but received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days.
Activity
Dotnet-GitSync-Bot commentedon Aug 16, 2020
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.
gfoidl commentedon Aug 16, 2020
Beginning with .NET 5 just use
VectorXYZ.Createwith constant values. E.g.Then the JIT will emit a "constant" which is then loaded from memory.
#35857 introduced that.
Before .NET 5 there are two patterns:
Or if the constant vector is of a type with size of one byte (so byte, sbyte, ...):
This version uses C#'s ability to read ROS from static data segment of the assembly. See https://vcsjones.dev/2019/02/01/csharp-readonly-span-bytes-static/ for further infos.
Always measure your goals, and don't just blindly rely on advices, as there may be some corner-cases, etc.
Good idea to have this infos consolidated at one place.
Side note: it's now called Microsoft Docs.
dotnet-policy-service commentedon Mar 16, 2025
Due to lack of recent activity, this issue has been marked as a candidate for backlog cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.
This process is part of our issue cleanup automation.
dotnet-policy-service commentedon Mar 30, 2025
This issue will now be closed since it had been marked
no-recent-activitybut received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days.