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

Remove unnecessary List<T> instantiation #2588

Merged
merged 2 commits into from
Oct 5, 2017
Merged

Remove unnecessary List<T> instantiation #2588

merged 2 commits into from
Oct 5, 2017

Conversation

davkean
Copy link
Member

@davkean davkean commented Oct 5, 2017

This was the cause of a large amount (1.2%) of allocations in a large project, some of which end up on the large object heap.

Large project from a partner:
image

Smaller project with mix of .NET Framework/.NET Standard projects:
image

This was the cause of a large amount (1.2%) of allocations in a large project some of which end up on the large object heap.
@davkean
Copy link
Member Author

davkean commented Oct 5, 2017

tag @Pilchie

@@ -401,13 +401,10 @@ private LazyItemList GetItemList(string itemType)
return ret;
}

public IList<ItemData> GetAllItems()
public IEnumerable<ItemData> GetAllItems()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth at least commenting that this is deferred, so that callers can be careful about multiple enumerations. Or consider changing the name to make it more clear.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll change the name.

Gives a better indication not to iterate multiple times.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants