Skip to content

Commit

Permalink
refactor: ToSortedCollection (#1038)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveSkender authored Apr 8, 2023
1 parent 4a81d4d commit 82d5dc4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/_common/Generics/Sorting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static Collection<TSeries> ToSortedCollection<TSeries>(
this IEnumerable<TSeries> series)
where TSeries : ISeries
=> series
.ToSortedList()
.OrderBy(x => x.Date)
.ToCollection();

internal static List<TSeries> ToSortedList<TSeries>(
Expand Down
5 changes: 4 additions & 1 deletion tests/performance/Perf.Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ public class HelperPerformance
public static void SetupIntraday() => i = TestData.GetIntraday();

[Benchmark]
public object SortToList() => h.ToSortedList();
public object ToSortedList() => h.ToSortedList();

[Benchmark]
public object ToSortedCollection() => h.ToSortedCollection();

[Benchmark]
public object ToListQuoteD() => h.ToQuoteD();
Expand Down

0 comments on commit 82d5dc4

Please sign in to comment.