Skip to content

Commit a893f4a

Browse files
nareshjoNaresh Joshi
andauthored
Reduce allocations in JsonRuntimeFormat.ReadRuntimeDescription by pre-sizing List (#7086)
Co-authored-by: Naresh Joshi <[email protected]>
1 parent 4bacd05 commit a893f4a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/NuGet.Core/NuGet.Packaging/RuntimeModel/JsonRuntimeFormat.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ private static RuntimeDescription ReadRuntimeDescription(KeyValuePair<string, JT
208208
var imports = property.Value as JArray;
209209
foreach (var import in imports)
210210
{
211-
inheritedRuntimes ??= new();
211+
inheritedRuntimes ??= new List<string>(imports.Count);
212212
inheritedRuntimes.Add(import.Value<string>());
213213
}
214214
}

0 commit comments

Comments
 (0)