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

Remove some Task allocations from JsonWebTokenHandler #2167

Merged
merged 1 commit into from
Jul 26, 2023

Conversation

stephentoub
Copy link
Collaborator

These methods are all private and all of the call sites directly await them. They can be ValueTasks to avoid allocating on the synchronously-completing path (which I see happening reasonably frequently in traces).

These methods are all private and all of the call sites directly await them.  They can be ValueTasks to avoid allocating on the synchronously-completing path (which I see happening reasonably frequently in traces).
@dosper7
Copy link

dosper7 commented Jul 26, 2023

Just out of curiosity and for learning purposes, can you share one of those traces? To have an idea of how you check this things? Thanks.

@keegan-caruso keegan-caruso merged commit 8d13eb7 into AzureAD:dev7x Jul 26, 2023
@jennyf19 jennyf19 added this to the 7.0.0-preview2 milestone Jul 27, 2023
brentschmaltz pushed a commit that referenced this pull request Jul 28, 2023
These methods are all private and all of the call sites directly await them.  They can be ValueTasks to avoid allocating on the synchronously-completing path (which I see happening reasonably frequently in traces).
@stephentoub stephentoub deleted the handlervaluetask branch August 15, 2023 01:51
@stephentoub
Copy link
Collaborator Author

Just out of curiosity and for learning purposes, can you share one of those traces? To have an idea of how you check this things? Thanks.

Sorry, @dosper7, I don't have them available. But it wasn't anything fancy, just a dotnet trace taken of a system interacting with JWTs. Actually, two traces, one for CPU and one for allocation. For this PR and others related to allocation, I just looked through the list at each type being allocated, looked to see where they were coming from, and looked to see whether they were easily avoidable. I typically start by looking at the strings and arrays, as there's often low-hanging fruit there and they're also often at the top of the most-allocated list, and also look for things that stand out as not belonging, e.g. when value types show up in the allocation list, that means boxing, which is often avoidable.

brentschmaltz pushed a commit that referenced this pull request Sep 6, 2023
These methods are all private and all of the call sites directly await them.  They can be ValueTasks to avoid allocating on the synchronously-completing path (which I see happening reasonably frequently in traces).
brentschmaltz pushed a commit that referenced this pull request Sep 7, 2023
These methods are all private and all of the call sites directly await them.  They can be ValueTasks to avoid allocating on the synchronously-completing path (which I see happening reasonably frequently in traces).
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.

5 participants