Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sep 0.4.0 #61

Merged
merged 3 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions NCsvPerf/CsvReadable/Benchmarks/PackageAssetsSuite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,12 @@ public void Sep()
Execute(new Sep());
}

[Benchmark]
public void Sep_MT()
{
Execute(new Sep_MT());
}

[Benchmark]
public void ServiceStack_Text()
{
Expand Down
29 changes: 29 additions & 0 deletions NCsvPerf/CsvReadable/Implementations/Sep_MT.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using nietras.SeparatedValues;

namespace Knapcode.NCsvPerf.CsvReadable
{
public class Sep_MT : ICsvReader
{
public List<T> GetRecords<T>(MemoryStream stream) where T : ICsvReadable, new()
{
using var reader = nietras.SeparatedValues.Sep.Reader(o => o with
{
HasHeader = false,
#if ENABLE_STRING_POOLING
CreateToString = SepToString.PoolPerColThreadSafeFixedCapacity(maximumStringLength: 128),
#endif
})
.From(stream);

return reader.ParallelEnumerate(row =>
{
var record = new T();
record.Read(row.UnsafeToStringDelegate);
return record;
}).ToList();
}
}
}
2 changes: 1 addition & 1 deletion NCsvPerf/NCsvPerf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<PackageReference Include="NReco.Csv" Version="1.0.2" />
<PackageReference Include="Open.Text.CSV" Version="3.4.0" />
<PackageReference Include="RecordParser" Version="2.3.0" />
<PackageReference Include="Sep" Version="0.3.0" />
<PackageReference Include="Sep" Version="0.4.0" />
<PackageReference Include="ServiceStack.Text" Version="6.11.0" />
<PackageReference Include="Sky.Data.Csv" Version="2.5.0" />
<PackageReference Include="SoftCircuits.CsvParser" Version="4.1.0" />
Expand Down
2 changes: 1 addition & 1 deletion NCsvPerf/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ private static void Main(string[] args)
#else
config = null;
#endif
BenchmarkRunner.Run<PackageAssetsSuite>(config);
BenchmarkRunner.Run<PackageAssetsSuite>(config, args);
}
}
}