Use in keyword wherever possible
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 32/100
- Issue type
- Refactor
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- csharp
- Domain
- performance
Research direction
Start with the float4 multiplication operator shown in the issue, then inspect other methods and operators that copy parameters. Determine which cases can use the in keyword without changing behavior, and verify that the affected operations retain their behavior while improving performance outside Burst.
Written by the indexing model from the issue text.
Description
there is no need to indirectly create a copy of parameters in most cases. using in can drastically improve performance for several methods and operators.
for example changing float4 multiply to
public static float4 operator * (in float4 lhs, in float4 rhs) { return new float4 (lhs.x * rhs.x, lhs.y * rhs.y, lhs.z * rhs.z, lhs.w * rhs.w); }
results in a massive performance improvement in .Net 5 (hopefully similar in Mono) ~3.1 ns vs ~0.1 ns (intel 7th gen)
burst might do that already internally but it could finally make this library faster than the built in Vector3/4/... outside of Burst
PS: soon™ https://docs.microsoft.com/en-us/dotnet/api/system.math.sincos?view=net-6.0
- Dominant language
- C#
- Stars
- 1.4k
- Forks
- 159
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Unity-Technologies/Unity.Mathematics
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
Unity-Technologies/Unity.Mathematics#245 · 3 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
Unity-Technologies/Unity.Mathematics#243 · 6 reactions ·
All issues in Unity-Technologies/Unity.Mathematics
Similar issues
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
Type: enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
apache/arrow-adbc#4809 ·
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
microsoft/vscode-azurefunctions#5197 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
microsoft/microsoft-ui-reactor#1274 ·