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

Delete ImmutableHashMap #31408

Closed
wants to merge 2 commits into from

Conversation

jasonmalinowski
Copy link
Member

This doesn't seem to be notably faster than just using the framework library; in a case where we're doing an excessive number of GetProject calls this only is saving us a few dozen milliseconds over all of loading Roslyn.sln.

@jasonmalinowski
Copy link
Member Author

For those following along at home, I'm not going to merge this until I can do an RPS run internally, and right now we're still sorting things out internally.

@jinujoseph
Copy link
Contributor

pre-approved , conditional on what we find on RPS run

@jinujoseph jinujoseph added this to the 16.0.P3 milestone Jan 5, 2019
@jinujoseph jinujoseph modified the milestones: 16.0.P3, 16.1.P3 Apr 15, 2019
@jinujoseph jinujoseph modified the milestones: 16.1.P3, 16.1 Apr 24, 2019
@jinujoseph jinujoseph modified the milestones: 16.1, 16.3 Jun 9, 2019
@jasonmalinowski jasonmalinowski modified the milestones: 16.3, 16.4 Sep 6, 2019
@jinujoseph jinujoseph modified the milestones: 16.4, 16.5 Dec 11, 2019
@jasonmalinowski jasonmalinowski modified the milestones: 16.5, 16.6 Jan 17, 2020
@CyrusNajmabadi
Copy link
Member

@jasonmalinowski can this be moved forward with?

@jasonmalinowski jasonmalinowski removed the request for review from heejaechang May 11, 2020 21:53
@jinujoseph jinujoseph modified the milestones: 16.6, Backlog Jun 4, 2020
@sharwell
Copy link
Member

sharwell commented Jul 2, 2020

This doesn't seem to be notably faster than just using the framework library

This is because both implementations use the same inefficient storage strategy. 😄 I'm working on improving this space but this PR wouldn't block that work.

Base automatically changed from master to main March 3, 2021 23:51
@jasonmalinowski jasonmalinowski force-pushed the dev/jasonmal/delete-immutablehashmap branch from 53f4af1 to 8802c4b Compare September 22, 2021 01:23
@sharwell
Copy link
Member

ImmutableSegmentedDictionary<TKey, TValue> is now available for use in Roslyn if you need an immutable dictionary with high-performance indexing.

@jasonmalinowski jasonmalinowski force-pushed the dev/jasonmal/delete-immutablehashmap branch from 8802c4b to c6cf7d9 Compare October 1, 2021 22:28
@jasonmalinowski
Copy link
Member Author

@sharwell It's been so long I don't even remember how "slow" the standard one is in this case....IIRC there was little to no cost with the standard one but will look again.

@@ -227,19 +226,40 @@ public bool ContainsAnalyzerConfigDocument(DocumentId documentId)
/// Get the document in this project with the specified document Id.
/// </summary>
public Document? GetDocument(DocumentId documentId)
=> ImmutableHashMapExtensions.GetOrAdd(ref _idToDocumentMap, documentId, s_tryCreateDocumentFunction, this);
{
if (ContainsDocument(documentId))
Copy link
Member Author

@jasonmalinowski jasonmalinowski Oct 1, 2021

Choose a reason for hiding this comment

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

ImmutableHashMapExtensions.GetOrAdd had an important behavior that meant if the lookup into the dictionary missed, it'd call the creation function, and if it returned null would then return null without adding the item. The standard ImmutableInterlocked.GetOrAdd does not do such a thing; this pattern is the pattern we use in Solution.GetProject so I'm using it here until we have data to argue for something better/different.

This doesn't seem to be notably faster than just using the framework
library; in a case where we're doing an excessive number of GetProject
calls this only is saving us a few dozen milliseconds over all of
loading Roslyn.sln.
@jasonmalinowski jasonmalinowski force-pushed the dev/jasonmal/delete-immutablehashmap branch from c6cf7d9 to ebaf812 Compare October 4, 2021 22:29
@CyrusNajmabadi
Copy link
Member

@jasonmalinowski can we move forward with this?

@jasonmalinowski
Copy link
Member Author

Obsoleted by #72520.

@jasonmalinowski jasonmalinowski deleted the dev/jasonmal/delete-immutablehashmap branch May 21, 2024 18:24
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.

6 participants