Repository navigation
[Blazor WASM] - Investigate 6% size regression in System.Collections.dll.br #51572
Description
Activity
- ghost addeduntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner
on Apr 20, 2021 Likely related to #51571. Seeing lots of infrastructure to support
SortedDictionaryandSortedSetcoming back into the assembly. Will track down the callers.I believe the code path below is responsible for this regression.
runtime/src/libraries/System.Text.Json/src/System/Text/Json/Node/JsonObject.IDictionary.cs
Lines 108 to 124 in ccc25a9
public bool Remove(string propertyName) { if (propertyName == null) { throw new ArgumentNullException(nameof(propertyName)); } if (!Dictionary.TryGetValue(propertyName, out JsonNode? item)) { return false; } bool success = Dictionary.Remove(propertyName); Debug.Assert(success); DetachParent(item); return true; } In particular, on line 120, there's a call to
Dictionary.Remove(string). However, theDictionaryproperty getter is typed asIDictionary<,>, backed by anIDictionary<,>field. This means that the linker needs to keep every possible implementation ofIDictionary<,>.Removearound, and in the case ofSortedDictionary<,>that means also keeping much of theSortedSet<>infrastructure around as well.If the
Dictionaryproperty getter is changed to be a strongly-typedDictionary<,>rather than an interfaceIDictionary<,>I believe this might resolve the issue, since the target method will now be statically known rather than a virtual dispatch.cc @steveharter. This overlaps with the effort to use a strongly-typed sorted dictionary to store
JsonObjectvalues (to preserve insertion order when enumerating over the object).
That aside, this is related to #51311 and my comment here #51571 (comment).
- removeduntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner
on Apr 21, 2021 - ghost addedin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged
on Apr 22, 2021 - ghost removedin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged
on Apr 28, 2021 - ghost locked as resolved and limited conversation to collaborators
on May 28, 2021

Size increase in System.Collections.dll.br as observed in https://msit.powerbi.com/groups/me/apps/54e0e83f-07bc-45bf-87b7-a7677ff3af2a/dashboards/fa051820-ff60-4d40-8a08-bdcc1b47b1d0
cc @CoffeeFlux - is this worth investigating ?