-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding CsvWriter performance tests (#4)
- Loading branch information
Showing
7 changed files
with
72 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System.Collections.Generic; | ||
using System.Globalization; | ||
using System.IO; | ||
|
||
using BenchmarkDotNet.Attributes; | ||
|
||
namespace CsvHelper.FastDynamic.Performance | ||
{ | ||
[MemoryDiagnoser] | ||
public class WriterBenchmark | ||
{ | ||
private const string SampleCsvFile = @".\sampledata\SFO_Airport_Monthly_Utility_Consumption_for_Natural_Gas__Water__and_Electricity.csv"; | ||
|
||
public WriterBenchmark() | ||
{ | ||
using var csvReader = new CsvReader(new StreamReader(SampleCsvFile), CultureInfo.InvariantCulture); | ||
|
||
_sampleCsvData = csvReader.GetDynamicRecords(); | ||
} | ||
|
||
private readonly IReadOnlyList<dynamic> _sampleCsvData; | ||
|
||
[Benchmark] | ||
public void WriteRecords() | ||
{ | ||
using var csvWriter = new CsvWriter(new StringWriter(), CultureInfo.InvariantCulture); | ||
|
||
csvWriter.WriteRecords(_sampleCsvData); | ||
} | ||
|
||
[Benchmark] | ||
public void WriteDynamicRecords() | ||
{ | ||
using var csvWriter = new CsvWriter(new StringWriter(), CultureInfo.InvariantCulture); | ||
|
||
csvWriter.WriteDynamicRecords(_sampleCsvData); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters