-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Streamline rent/return on ArrayPool #55710
Merged
Merged
Conversation
This file contains 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
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
Tagging subscribers to this area: @GrabYourPitchforks, @dotnet/area-system-buffers Issue DetailsA variety of tweaks to reduce overheads:
|
jkotas
reviewed
Jul 15, 2021
src/libraries/System.Private.CoreLib/src/System/Buffers/Utilities.cs
Outdated
Show resolved
Hide resolved
jkotas
reviewed
Jul 15, 2021
src/libraries/System.Private.CoreLib/src/System/Buffers/TlsOverPerCoreLockedStacksArrayPool.cs
Outdated
Show resolved
Hide resolved
jkotas
reviewed
Jul 15, 2021
src/libraries/System.Private.CoreLib/src/System/Buffers/TlsOverPerCoreLockedStacksArrayPool.cs
Show resolved
Hide resolved
jkotas
approved these changes
Jul 15, 2021
stephentoub
force-pushed
the
arraypoolslim
branch
from
July 15, 2021 13:47
3e41ca3
to
73335cd
Compare
- Stop storing and using a _bucketArraySizes. It's cheaper to recompute the shift on each use than it is to index into the array (with a bounds check). Plus less memory. - The 99% case is renting a positive length for pooled array sizes (especially now that we've bumped the limit up to a gig). Move the checks for lengths <= 0 to after the check for whether the length is poolable. - Move arrays into locals to enable the JIT to eliminate some bounds checks. - Use ThrowHelpers where we already have them - Move non-generic helpers out of generic class into Utilities - Consolidate buffer allocation in Rent to a single line - Reorganize TLS checks to be as early as possible - Use FastMod instead of % in per-core stacks
stephentoub
force-pushed
the
arraypoolslim
branch
from
July 15, 2021 15:58
73335cd
to
23d2b73
Compare
This was referenced Jul 28, 2021
ghost
locked as resolved and limited conversation to collaborators
Aug 15, 2021
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
A variety of tweaks to reduce overheads: