-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand DefaultBufferSize remarks #3146
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
Conversation
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.
Text-wise looks good. Just left some suggestions to add the thousand separator. @ahsonkhan should review for accuracy.
Co-Authored-By: Maira Wenzel <mairaw@microsoft.com>
Co-Authored-By: Maira Wenzel <mairaw@microsoft.com>
The default buffer size, in bytes, is 16,384. | ||
For most workloads, the default size is a reasonable amount of JSON to buffer while reading from a stream or writing to a stream. | ||
That is, it performs well without creating objects in the Large Object Heap for the Garbage Collector (GC) to track. | ||
We recommend that you leave this value unchanged unless changing it makes an observable difference in performance. |
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.
cc @steveharter - please review
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.
LGTM
Co-Authored-By: Ahson Khan <ahson_ahmedk@yahoo.com>
@steveharter is this good to merge? |
Should we just merge this one or should we wait for @steveharter's approval? |
For most workloads, the default size is a reasonable amount of JSON to buffer while reading from a stream or writing to a stream. | ||
That is, it performs well without creating objects on the Large Object Heap for the Garbage Collector (GC) to track. | ||
We recommend that you leave this value unchanged unless changing it makes an observable difference in performance. | ||
For example, if your JSON is always in small payloads, you could run tests with the default buffer size at 4,096 to find out if performance improves significantly. |
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.
We can consider adding something like this as well.
Conversely, if your JSON is known to be really large and in memory (such as returned as string or UTF-8 bytes rather than writing to a stream), setting the default buffer size to a large upper bound could help improve performance.
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 don't think decreasing it will improve performance in any normal scenario unless the available memory is extremely low (since 16K is not very much). However @ahsonkhan suggestion of increasing it in non-streaming scenarios is a known benefit for JSON sizes that are known to be large.
I think it looks good to merge. |
Related to dotnet/docs#12207
Staging URL