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

[Event Hubs] Minor Performance Tweaks #26983

Merged
merged 4 commits into from Feb 14, 2022
Merged

Conversation

jsquire
Copy link
Member

@jsquire jsquire commented Feb 12, 2022

Summary

The focus of these changes is to apply some of the performance-oriented tweaks made in Service Bus to the Event Hubs clients. Included are:

  • Attempt to retrieve AMQP objects synchronously before calling GetOrCreateAsync

  • Remove LINQ from the AmqpMessageConverter

  • Change the internal batch AsEnumerable<T> to AsList<T> in order to avoid casting costs and have Count available to right-size transform collections.

  • Use the two item overload when creating a linked token source to avoid allocating an unnecessary array. (ref)

References and Resources

The focus of these changes is to apply some of the performance-oriented
tweaks made in Service Bus to the Event Hubs clients.   Included are:

- Attempt to retrieve AMQP objects synchronously before calling `GetOrCreateAsync`

- Remove LINQ from the `AmqpMessageConverter`

- Change the internal batch `AsEnumerable<T>` to `AsList<T>` in order to avoid
  casting costs and have `Count` available to right-size transform collections.

- Use the two item overload when creating a linked token source to avoid
  allocating an unnecessary array.  _([ref](https://github.com/dotnet/runtime/blob/main/src/libraries/System.Private.CoreLib/src/System/Threading/CancellationTokenSource.cs#L736-L739))_
@jsquire jsquire added Event Hubs Client This issue points to a problem in the data-plane of the library. labels Feb 12, 2022
@jsquire jsquire added this to the [2022] March milestone Feb 12, 2022
@jsquire jsquire self-assigned this Feb 12, 2022
@jsquire
Copy link
Member Author

jsquire commented Feb 12, 2022

@danielmarbach: I'd appreciate any thoughts and feedback that you may have.

@jsquire
Copy link
Member Author

jsquire commented Feb 12, 2022

/azp run net - eventhub - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

…erializing the enumerable in the public API call site
@jsquire jsquire merged commit 3bfb0f8 into Azure:main Feb 14, 2022
@jsquire jsquire deleted the eventhubs/perf-tweaks branch February 14, 2022 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. Event Hubs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants