Skip to content

Commit 45e1329

Browse files
committed
Added XML docs about FixedSizePriorityMap
1 parent 96e8e48 commit 45e1329

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Microsoft.Toolkit.HighPerformance/Buffers/StringPool.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff 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>

0 commit comments

Comments
 (0)