Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit c65020b

Browse files
committed
Merge pull request #217 from adamsitnik/master
performance: create list with predefined size to avoid unnecessary GC
2 parents 156bb53 + 2b400c2 commit c65020b

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/ServiceStack.Redis/UtilExtensions.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
1+
using System.Collections.Generic;
52
using ServiceStack.Text;
63

74
namespace ServiceStack.Redis
85
{
96
internal static class UtilExtensions
107
{
11-
public static List<T> ConvertEachTo<T>(this IEnumerable<string> list)
8+
public static List<T> ConvertEachTo<T>(this List<string> list)
129
{
13-
var to = new List<T>();
10+
var to = new List<T>(list.Count);
1411
foreach (var item in list)
1512
{
1613
to.Add(JsonSerializer.DeserializeFromString<T>(item));

0 commit comments

Comments
 (0)