You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is primarily caused by an inefficient implementation of Project.Documents. In order of impact (most impactful items first):
Each call to GetDocument produces a call to ContainsDocument, which is slow and unnecessary in this context
ImmutableHashMap<TKey, TValue>.TryGetValue is slow, particularly in the implementation of HashBucket.Get
DocumentIds is implemented with ImmutableList<T>, which has an inefficient enumerator
Options we could potentially take:
Move DocumentIds to be an ImmutablArray. this will make iteration very good, and will also have a nice compact representation. However, it may exhibit poorer behavior if a project is forked many times with lots of changes to the doc array.
GetDocument could have an private implementation that does/doesn't check for containment. .Documents would call the version that doesn't check containment since it can't ever fail.
We could switch the map we use from ImmutableHashMap to dictionary. This may exhibit issues though as we'll need something to lock on (and that could be contentious). We'd also incur an allocation for the lock/dictionary for hte empty case, which we don't have today.
None of these issues may be problematic in practice. But it's not evident up front that they won't be.
The text was updated successfully, but these errors were encountered:
From #48597 (comment)
Options we could potentially take:
DocumentIds
to be anImmutablArray
. this will make iteration very good, and will also have a nice compact representation. However, it may exhibit poorer behavior if a project is forked many times with lots of changes to the doc array.None of these issues may be problematic in practice. But it's not evident up front that they won't be.
The text was updated successfully, but these errors were encountered: