Skip to content

Commit f58d042

Browse files
authored
Optimize RecordSetHeader.Add() avoid .Concat().ToArray(n) (#430)
1 parent 0a9983f commit f58d042

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Orm/Xtensive.Orm/Orm/Rse/RecordSetHeader.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,14 @@ public RecordSetHeader Add(Column column)
9696
/// <returns>The constructed header.</returns>
9797
public RecordSetHeader Add(IReadOnlyList<Column> columns)
9898
{
99-
var n = Columns.Count + columns.Count;
100-
var newColumns = Columns.Columns.Concat(columns).ToArray(n);
99+
var newColumns = new Column[Columns.Count + columns.Count];
100+
int i = 0;
101+
foreach (var c in Columns.Columns) {
102+
newColumns[i++] = c;
103+
}
104+
foreach (var c in columns) {
105+
newColumns[i++] = c;
106+
}
101107

102108
var newTupleDescriptor = CreateTupleDescriptor(newColumns);
103109

0 commit comments

Comments
 (0)