-
Notifications
You must be signed in to change notification settings - Fork 1.4k
HighPerformance package improvements #3351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
29 commits merged into
CommunityToolkit:master
from
Sergio0694:improvement/high-performance-tweaks
Sep 24, 2020
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
b464ce2
Removed unnecessary attributes, improved codegen
Sergio0694 301b5fa
Added custom ArrayPool<T> field to Memoryowner<T>
Sergio0694 6bd669f
Added custom pool to ArrayPoolBufferWriter<T>
Sergio0694 d9b07d7
Minor codegen improvement to Box<T>
Sergio0694 a2217fa
Added custom pool to SpanwOwner<T>
Sergio0694 f4da592
Minor tweaks to ArrayPoolBufferWriter<T>
Sergio0694 1f6aed0
Added tests for invalid allocation sizes
Sergio0694 ae589c7
Added unit tests for custom array pool overloads
Sergio0694 a925554
Merge branch 'master' into improvement/high-performance-tweaks
Sergio0694 7e0d20a
Fixed bugs in two unit tests
Sergio0694 26b0a6d
Merge branch 'master' into improvement/high-performance-tweaks
Sergio0694 034a643
Merge branch 'master' into improvement/high-performance-tweaks
Sergio0694 5356623
Merge branch 'master' into improvement/high-performance-tweaks
Sergio0694 234dae7
Merge branch 'master' into improvement/high-performance-tweaks
Sergio0694 b22494c
Merge branch 'master' into improvement/high-performance-tweaks
Sergio0694 f31c2c7
Minor code style tweaks
Sergio0694 ae961dd
Minor codegen improvements
Sergio0694 54acdb3
Merge branch 'master' into improvement/high-performance-tweaks
Sergio0694 1438e39
Added more readonly modifiers to enumerators
Sergio0694 fbc3a4a
Merge branch 'master' into improvement/high-performance-tweaks
Sergio0694 8baecc2
Merge branch 'master' into improvement/high-performance-tweaks
Sergio0694 580eda5
Improved a comment, fixed a typo
Sergio0694 cf0f8aa
Merge branch 'master' into improvement/high-performance-tweaks
Sergio0694 84918ef
Merge branch 'master' into improvement/high-performance-tweaks
Sergio0694 ca46e0c
Added #ifdef block for unneeded using directive
Sergio0694 0c79764
Fixed incorrect XML docs
Sergio0694 49b1eba
Switched a Span<T>.CopyTo to Array.Copy
Sergio0694 7455284
Merge branch 'master' into improvement/high-performance-tweaks
Rosuavio 036dc78
Merge branch 'master' into improvement/high-performance-tweaks
Sergio0694 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am curious what the difference is here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory the codegen should be identical, but this version has a better IL encoding which should help with scenarios such as R2R when using crossgen (which has some inlining limitations with method calls), as well as cases where the indirect load might cause stack spills or just not be optimized best by the JIT (especially on older runtimes).
The difference is that the previous version basically invoked that generic
Unsafe.Unbox<T>and then issued aldobj !!Tinstruction to dereference thatT&value on the stack, whereas the second is simply resolved into a singleunbox.any !!Topcode, which is the same being used by normal unbox operations. This change is mostly just a precaution to help crossgen and the JIT to always produce the most optimal codegen possible, it has no actual functional changes.If you're interested, I made a small repro you can check out (here) - you can see that the asm x64 codegen is exactly the same on .NET Core 3.1, but if you switch to the IL tab you'll be able to see that different encoding I mentioned 😊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, that's pretty cool (the change and sharplab.io). Thanks @Sergio0694 😃