Skip to content

[Blazor WASM] - Investigate 6% size regression in System.Collections.dll.br #51572

Description

@SamMonoRT

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

image

cc @CoffeeFlux - is this worth investigating ?

Activity

  1. ghost added
    untriagedNew issue has not been triaged by the area owner
    on Apr 20, 2021
  2. GrabYourPitchforks commented on Apr 21, 2021

    @GrabYourPitchforks
    Member

    Likely related to #51571. Seeing lots of infrastructure to support SortedDictionary and SortedSet coming back into the assembly. Will track down the callers.

    image

  3. GrabYourPitchforks commented on Apr 21, 2021

    @GrabYourPitchforks
    Member

    I believe the code path below is responsible for this regression.

    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, the Dictionary property getter is typed as IDictionary<,>, backed by an IDictionary<,> field. This means that the linker needs to keep every possible implementation of IDictionary<,>.Remove around, and in the case of SortedDictionary<,> that means also keeping much of the SortedSet<> infrastructure around as well.

    If the Dictionary property getter is changed to be a strongly-typed Dictionary<,> rather than an interface IDictionary<,> I believe this might resolve the issue, since the target method will now be statically known rather than a virtual dispatch.

  4. layomia commented on Apr 21, 2021

    @layomia
    Contributor

    cc @steveharter. This overlaps with the effort to use a strongly-typed sorted dictionary to store JsonObject values (to preserve insertion order when enumerating over the object).


    That aside, this is related to #51311 and my comment here #51571 (comment).

  5. removed
    untriagedNew issue has not been triaged by the area owner
    on Apr 21, 2021
  6. added this to the 6.0.0 milestone on Apr 21, 2021
  7. self-assigned this
    on Apr 21, 2021
  8. ghost added
    in-prThere is an active PR which will close this issue when it is merged
    on Apr 22, 2021
  9. ghost removed
    in-prThere is an active PR which will close this issue when it is merged
    on Apr 28, 2021
  10. ghost locked as resolved and limited conversation to collaborators on May 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions