-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
investigateold-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels
Milestone
Description
It uses List, which gets assigned to RouteParameterNames
as IEnumerable.
var routeParamNames = new List<string>(pattern.Parameters.Count); |
Ran a benchmark with 10 strings of length 6. The results are below.
The benchmark code used:
public class Benchmarks
{
private const int Length = 10;
private readonly IReadOnlyCollection<string> _readOnlyCollection = new List<string>() { "param1","param2", "param1","param2", "param1","param2", "param1","param2", "param1","param2"}.AsReadOnly();
[Benchmark]
public void Add10StringsToList()
{
List<string> parameters = new(Length);
foreach (var s in _readOnlyCollection)
{
parameters.Add(s);
}
}
[Benchmark]
public void Add10StringsToArray()
{
var parameters = new string[Length];
var i = 0;
foreach (var s in _readOnlyCollection)
{
parameters[i] = s;
i++;
}
}
}
Metadata
Metadata
Assignees
Labels
investigateold-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels