private static List <List <long> > ParseIndexData(DsvReader reader) { var indexData = new List <List <long> >(); // Intially just use the default list capacity. // https://github.com/dotnet/corefx/blob/master/src/Common/src/CoreLib/System/Collections/Generic/List.cs#L24 var capacity = 4; while (reader.MoveNextRecord()) { var recordIndexData = new List <long>(capacity); while (reader.MoveNextValue()) { var value = reader.Current; recordIndexData.Add(Encode(reader.CurrentIndex, value.Length)); } indexData.Add(recordIndexData); // Assume the next row will have the same number of records as this one. capacity = recordIndexData.Count; } return(indexData); }
public DsvParser(DsvReader reader) { this.memory = reader.Memory; this.indexData = ParseIndexData(reader); }