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

Microsoft.CSharp code could use some refactoring/optimization #16890

Closed
jamesqo opened this issue Apr 2, 2016 · 2 comments
Closed

Microsoft.CSharp code could use some refactoring/optimization #16890

jamesqo opened this issue Apr 2, 2016 · 2 comments
Assignees
Milestone

Comments

@jamesqo
Copy link
Contributor

jamesqo commented Apr 2, 2016

This program:

public static void Main()
{
    for (int i = 0; i < 1000000000; i++)
    {
        dynamic thing = new object();
        thing.Equals(null);
    }
}

causes many GC marks when run from the Visual Studio profiler within a short period of time. Here's a snapshot from my machine:

Here's the data from the memory profiler about which objects are being allocated the most:

Of course, obviously perf is not the first consideration when using dynamic objects, but it looks like a lot of these could be avoided. I looked a bit further into the Microsoft.CSharp package where this code is coming from, and it looks like the code is somewhat of a mess. It uses a lot of Hungarian notation and classes with COM-style all-caps names. As for perf, here's a random example of where it could be optimized, and also here. As another example, this looks like it could be a struct.

Posting this here as a self-note, since I'm planning to submit a couple of PRs to remedy this in the next couple of weeks.

@karelz
Copy link
Member

karelz commented Oct 3, 2016

@jamesqo are you still working on it?

@karelz
Copy link
Member

karelz commented Nov 28, 2016

This is too nebulous and generic, we should track specific issues / improvements in the code.
Note: The code is very sensitive to appcompat, so any change in here has to be really worth it and has to be thought through all angles.

@karelz karelz closed this as completed Nov 28, 2016
@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 2.0.0 milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Jan 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants