Stop preventing inlining of Matrix.Identity by making Matrix.s_identity readonly.
#11364
+1
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
While trying to vectorize the WPF
Vector/Point/Matrixcode with limited success, I stumbled on some low-hanging fruits that could bring noticeable performance improvements to code usingMatrix.(See here for my tentatives: https://github.com/hexawyz/WpfVectorBenchmark/tree/master/WpfVectorBenchmark/A)
This first change is very simple but does allow the JIT to inline
Matrix.Identity, which was previously not the case. This might have been intentional at the time, I wouldn't know, but on the few simple benchmarks i was running, this improved performance by 10% to 23%.Also, if this ever intentional, this would have been done at a time where support for SIMD in the runtime was inexistant, so making the code more "correct" here should delegate the decision making to the JIT.
Customer Impact
Regression
This won't break any code, but it will change the performance characteristics of the code. While I would expect the change to be mostly positive, there could be scenarios where it induces a performance regression.
Testing
Benchmark
Risk
See the regression part
Microsoft Reviewers: Open in CodeFlow