Optimize ArrayBuilder.ToDictionary
to use SmallDictionary when appropriate
#69049
Labels
Milestone
ArrayBuilder.ToDictionary
to use SmallDictionary when appropriate
#69049
roslyn/src/Dependencies/PooledObjects/ArrayBuilder.cs
Lines 458 to 499 in 2fb8ad0
IDictionary<TKey,ImmutableArray<TValue>>
, then we can just useImmutableDictionary<K, ImmutableArray<T>>.Empty
. Otherwise, create our own cached empty.Motivation:
It looks like
GetSimpleNonTypeMembers
has 7.7% of CPU time in this trace, with most of its time inTryGetValue
. I'd imagine that there are some of these calls where the number of elements in the dictioanry is small enough thatSmallDictionary
can bring a better performance.The text was updated successfully, but these errors were encountered: