forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce code size impact of
ArrayPool<T>
(dotnet#97058)
* Reduce code size impact of `ArrayPool<T>` Every `SharedArrayPool<T>` brings with it several types, including several array types and all of their interface implementations. This makes the internals of SharedArrayPool a bit less generic to try to reduce that impact. The changes are effectively: - Move the nested Partition, Partitions, and ThreadLocalArray types out from being nested types to being peers - Rename them, since they're no longer inheriting the parent's name - Make them non-generic in terms of Array rather than generic in terms of T[]. These types never index into the array, so other than accessing Length for logging purposes, it could even have used object. - Use Unsafe.As in the two places arrays are dequeued and need to be T[] rather than Array. - Pass in the sizeof(T) rather than using it in the implementation. The size is used only when trimming to determine how much to trim. * Fix throughput regression from covariance check
- Loading branch information
1 parent
d1af285
commit 0ab6cfc
Showing
1 changed file
with
119 additions
and
108 deletions.
There are no files selected for viewing
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