-
-
Notifications
You must be signed in to change notification settings - Fork 103
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use RecyclableMemoryStream #107
Conversation
Codecov Report
@@ Coverage Diff @@
## master #107 +/- ##
==========================================
+ Coverage 77.19% 78.01% +0.82%
==========================================
Files 46 45 -1
Lines 1324 1128 -196
Branches 211 174 -37
==========================================
- Hits 1022 880 -142
+ Misses 238 191 -47
+ Partials 64 57 -7
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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.
Looks good, and we are likely fine with the default setup.
RecyclableMemoryStream
docs state:
Large Pool - Holds large buffers, which are only used when you must have a single, contiguous buffer, such as when you plan to call GetBuffer().
So, if no-one will invoke stream.(Try)GetBuffer
, all streams are puzzled together from 128 kbyte, small buffers, and the large pools remain untouched.
Note the reasoning behind that buffer size selection:
RecyclableMemoryStream improves GC performance by ensuring that the larger buffers used for the streams are put into the gen 2 heap and stay there forever. This should cause full collections to happen less frequently. If you pick buffer sizes above 85,000 bytes, then you will ensure these are placed on the large object heap, which is touched even less frequently by the garbage collector.
We need to adapt this size in ChunkedMemoryStream
!
Yep! |
Prerequisites
A replacement for #106 that uses
RecyclableMemoryStream
for buffer pooling.Note. Suggestions welcome for default pooling configuration values.