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 Client] AmqpConsumer Enhancement #19966

Merged
merged 1 commit into from
Mar 31, 2021

Conversation

jsquire
Copy link
Member

@jsquire jsquire commented Mar 30, 2021

Summary

The focus of these changes is to apply some of the Service Bus learnings to the AmqpConsumer for better efficiency and fewer allocations due to the closure.

Last Upstream Rebase

Tuesday, March 30, 5pm (EST)

References and Related

@jsquire jsquire added Event Hubs Client This issue points to a problem in the data-plane of the library. labels Mar 30, 2021
@jsquire jsquire added this to the [2021] April milestone Mar 30, 2021
@jsquire jsquire self-assigned this Mar 30, 2021
@jsquire
Copy link
Member Author

jsquire commented Mar 30, 2021

/azp run net - eventhub - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

).ConfigureAwait(false);

cancellationToken.ThrowIfCancellationRequested<TaskCanceledException>();

// If event messages were received, then package them for consumption and
// return them.

if ((messagesReceived) && (amqpMessages != null))
foreach (AmqpMessage message in messagesReceived)
Copy link
Member

@christothes christothes Mar 31, 2021

Choose a reason for hiding this comment

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

I was just curious about the perf impacts of removing the conditional check before doing the foreach on an empty enumerable and it's quite a bit slower (though very fast in absolute time)

|                 Method |     Mean |     Error |    StdDev | Ratio | RatioSD | Gen 0 | Gen 1 | Gen 2 | Allocated |
|----------------------- |---------:|----------:|----------:|------:|--------:|------:|------:|------:|----------:|
| ConditionalEnumeration | 1.132 ns | 0.0147 ns | 0.0137 ns |  1.00 |    0.00 |     - |     - |     - |         - |
|          DoEnumeration | 5.490 ns | 0.0459 ns | 0.0429 ns |  4.85 |    0.08 |     - |     - |     - |         - |

Copy link
Member Author

Choose a reason for hiding this comment

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

Interesting.

Copy link
Member Author

Choose a reason for hiding this comment

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

I tweaked to return null when nothing was received and added a check to bail out early if we have none.

The focus of these changes is to apply some of the Service Bus learnings
to the `AmqpConsumer` for better efficiency and fewer allocations due to
the closure.
@jsquire jsquire force-pushed the eventhubs/receiveclosure branch from 7d27886 to e22387f Compare March 31, 2021 15:25
@Azure Azure deleted a comment from check-enforcer bot Mar 31, 2021
@jsquire
Copy link
Member Author

jsquire commented Mar 31, 2021

/check-enforcer override

@jsquire jsquire merged commit 4908bb7 into Azure:master Mar 31, 2021
@jsquire jsquire deleted the eventhubs/receiveclosure branch March 31, 2021 16:04
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.

2 participants