File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Microsoft.Toolkit.HighPerformance/Buffers Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -311,6 +311,15 @@ public void Reset()
311311 /// <summary>
312312 /// A configurable map containing a group of cached <see cref="string"/> instances.
313313 /// </summary>
314+ /// <remarks>
315+ /// Instances of this type are stored in an array within <see cref="StringPool"/> and they are
316+ /// always accessed by reference - essentially as if this type had been a class. The type is
317+ /// also private, so there's no risk for users to directly access it and accidentally copy an
318+ /// instance, which would lead to bugs due to values becoming out of sync with the internal state
319+ /// (that is, because instances would be copied by value, so primitive fields would not be shared).
320+ /// The reason why we're using a struct here is to remove an indirection level and improve cache
321+ /// locality when accessing individual buckets from the methods in the <see cref="StringPool"/> type.
322+ /// </remarks>
314323 private struct FixedSizePriorityMap
315324 {
316325 /// <summary>
You can’t perform that action at this time.
0 commit comments