Skip to content
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

ARROW-4717 [C#] Consider exposing ValueTask instead of Task #4194

Closed
wants to merge 3 commits into from

Conversation

eerhardt
Copy link
Contributor

Eliminating allocations in the C# Arrow library:

  1. Use ValueTask instead of Task in the public APIs.
  2. Eliminate allocations in ArrayData constructor by taking an array directly instead of calling ToArray() every time.
  3. Remove some other minor allocations that provide no benefit.
  4. Also, add a simple NullCount == 0 check to optimize the case where there are no nulls in the data, but the null bitmap is filled with 0s instead of being empty.

With this change the ArrowReaderWithMemory benchmark in the repo goes from:

Before

Method Allocated Memory/Op
ArrowReaderWithMemory 5.84 KB

After

Method Allocated Memory/Op
ArrowReaderWithMemory 4.48 KB

@stephentoub @pgovind @chutchinson

- Eliminate allocations in ArrayData constructor.
- Optimize for when NullCount == 0
- Remove unnecessary allocations.
Revert some ValueTask usages back to Task.
@eerhardt
Copy link
Contributor Author

@xhochy @wesm @kou - I believe all feedback has been addressed and this is ready to be merged.

Copy link
Member

@wesm wesm left a comment

Choose a reason for hiding this comment

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

+1

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.

None yet

3 participants