Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/Build/BackEnd/Components/RequestBuilder/BatchingEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,6 @@ private static List<ItemBucket> BucketConsumedItems(
buckets.Insert(~matchingBucketIndex, matchingBucket);
}

matchingBucket.Lookup.EnsureCapacity(items.Count);

// We already have a bucket for this type of item, so add this item to
// the bucket.
matchingBucket.AddItem(item);
Expand Down
22 changes: 2 additions & 20 deletions src/Build/BackEnd/Components/RequestBuilder/Lookup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ private void MergeScopeIntoLastScope()
// adds to the world
if (PrimaryAddTable != null)
{
SecondaryTable ??= new ItemDictionary<ProjectItemInstance>(PrimaryAddTable.ItemTypesCount);
SecondaryTable ??= new ItemDictionary<ProjectItemInstance>();
SecondaryTable.ImportItems(PrimaryAddTable);
}

Expand Down Expand Up @@ -706,24 +706,6 @@ internal void AddNewItemsOfItemType(string itemType, ICollection<ProjectItemInst
PrimaryAddTable.ImportItemsOfType(itemType, itemsToAdd);
}

/// <summary>
/// Attempts to set the initial capacity of the primary add table.
/// </summary>
/// <param name="capacity"></param>
internal void EnsureCapacity(int capacity)
{
if (PrimaryAddTable is null)
{
PrimaryAddTable = new ItemDictionary<ProjectItemInstance>(capacity);
}
#if NET
else
{
PrimaryAddTable.EnsureCapacity(capacity);
}
#endif
}

/// <summary>
/// Implements a true add, an item that has been created in a batch.
/// </summary>
Expand Down Expand Up @@ -830,7 +812,7 @@ internal void ModifyItems(string itemType, ICollection<ProjectItemInstance> grou
}
}

#endregion
#endregion

#region Private Methods

Expand Down
3 changes: 0 additions & 3 deletions src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1384,7 +1384,6 @@ private void GatherTaskItemOutputs(bool outputTargetIsItem, string outputTargetN
{
// Only count non-null elements. We sometimes have a single-element array where the element is null
bool hasElements = false;
_batchBucket.Lookup.EnsureCapacity(outputs.Length);

foreach (ITaskItem output in outputs)
{
Expand Down Expand Up @@ -1549,8 +1548,6 @@ private void GatherArrayStringAndValueOutputs(bool outputTargetIsItem, string ou
{
if (outputTargetIsItem)
{
_batchBucket.Lookup.EnsureCapacity(outputs.Length);

// to store the outputs as items, use the string representations of the outputs as item-specs
foreach (string output in outputs)
{
Expand Down
32 changes: 1 addition & 31 deletions src/Build/Collections/ItemDictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,27 +82,7 @@ public ItemDictionary(IEnumerable<T> items)
/// <summary>
/// Number of items in total, for debugging purposes.
/// </summary>
public int Count
{
get
{
lock (_itemLists)
{
return _nodes.Count;
}
}
}

public int ItemTypesCount
{
get
{
lock (_itemLists)
{
return _itemLists.Count;
}
}
}
public int Count => _nodes.Count;

/// <summary>
/// Get the item types that have at least one item in this collection
Expand Down Expand Up @@ -150,16 +130,6 @@ public ICollection<T> this[string itemtype]
}
}

#if NET
public void EnsureCapacity(int desiredCapacity)
{
lock (_itemLists)
{
_itemLists.EnsureCapacity(desiredCapacity);
}
}
#endif

/// <summary>
/// Empty the collection
/// </summary>
Expand Down