Avoid some struct copying during array building
This commit is contained in:
parent
6e4d0dbca4
commit
9da3260eb7
|
|
@ -45,8 +45,8 @@ namespace Microsoft.Blazor.RenderTree
|
|||
/// Appends a new item, automatically resizing the underlying array if necessary.
|
||||
/// </summary>
|
||||
/// <param name="item">The item to append.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Append(T item)
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)] // Just like System.Collections.Generic.List<T>
|
||||
public void Append(in T item)
|
||||
{
|
||||
if (_itemsInUse == _items.Length)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ namespace Microsoft.Blazor.RenderTree
|
|||
public ArrayRange<RenderTreeNode> GetNodes() =>
|
||||
_entries.ToRange();
|
||||
|
||||
private void Append(RenderTreeNode node)
|
||||
private void Append(in RenderTreeNode node)
|
||||
{
|
||||
_entries.Append(node);
|
||||
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ namespace Microsoft.Blazor.RenderTree
|
|||
return index;
|
||||
}
|
||||
|
||||
private void Append(RenderTreeEdit entry)
|
||||
private void Append(in RenderTreeEdit entry)
|
||||
{
|
||||
if (entry.Type == RenderTreeEditType.StepOut)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue