Skip to content

Commit

Permalink
Initialize list count in CreateClaims (#2596)
Browse files Browse the repository at this point in the history
This reduces how many internal array allocations need to happen for each claim set. In my benchmark I have 17 claims, which is kind of a worst case scenario because it starts at 4 and doubles to 32 before the list is big enough.
  • Loading branch information
eerhardt authored May 15, 2024
1 parent a1530a0 commit ec0ae43
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ internal List<Claim> Claims(string issuer)

internal List<Claim> CreateClaims(string issuer)
{
var claims = new List<Claim>();
var claims = new List<Claim>(_jsonClaims.Count);
foreach (KeyValuePair<string, object> kvp in _jsonClaims)
CreateClaimFromObject(claims, kvp.Key, kvp.Value, issuer);

Expand Down

0 comments on commit ec0ae43

Please sign in to comment.