Skip to content

Conversation

gathogojr
Copy link
Contributor

Issues

This pull request fixes #3359.

Description

Refactor BufferedJsonReader async paths to reduce GC pressure

Checklist (Uncheck if it is not completed)

  • Test cases added
  • Build and test with one-click build and test script passed

Additional work necessary

If documentation update is needed, please add "Docs Needed" label to the issue and provide details about the required document change in the issue.

Repository notes

Team members can start a CI build by adding a comment with the text /AzurePipelines run to a PR. A bot may respond indicating that there is no pipeline associated with the pull request. This can be ignored if the build is triggered.

Team members should not trigger a build this way for pull requests coming from forked repositories. They should instead trigger the build manually by setting the "branch" to refs/pull/{prId}/merge where {prId} is the ID of the PR.

/// </summary>
/// <returns>A Stream used to read a stream value</returns>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1825:Avoid zero-length array allocations.", Justification = "<Pending>")]
[SuppressMessage("Performance", "CA1825:Avoid zero-length array allocations.", Justification = "<Pending>")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still relevant? Where are we doing a zero-lengh array allocation in this method?

BufferedNode node = this.currentBufferedNode;
if (node.Value is string || node.Value == null || node.NodeType == JsonNodeType.StartArray || node.NodeType == JsonNodeType.StartObject)
{
return CachedTasks.True;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this lead to an improvement over Task.FromResult(false) (which already returns a cached result)? I guess your approach avoids the overhead of type checks, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor BufferedJsonReader async paths to reduce GC pressure

2 participants