update benchmarks debug mode

This commit is contained in:
wei 2021-05-05 11:36:19 +08:00
parent 44b89cccac
commit 165f015457
13 changed files with 70 additions and 54 deletions

View File

@ -50,7 +50,7 @@ Please Check [TODO](https://github.com/shps951023/MiniExcel/projects/1?fullscre
### Performance
[**Test1,000,000x10.xlsx**](https://github.com/shps951023/MiniExcel/blob/master/samples/xlsx/Test1%2C000%2C000x10/Test1%2C000%2C000x10.xlsx) as performance test basic file,A total of 10,000,000 "HelloWorld" with a file size of 23 MB
[**Test1,000,000x10.xlsx**](https://github.com/shps951023/MiniExcel/blob/master/samples/xlsx/Test1%2C000%2C000x10.xlsx) as performance test basic file,A total of 10,000,000 "HelloWorld" with a file size of 23 MB
Benchmarks logic can be found in [MiniExcel.Benchmarks](https://github.com/shps951023/MiniExcel/tree/master/benchmarks/MiniExcel.Benchmarks) , and test cli

View File

@ -53,7 +53,7 @@ MiniExcel简单、高效避免OOM的.NET处理Excel查、写、填充数据工
### 性能测试
以 [**Test1,000,000x10.xlsx**](https://github.com/shps951023/MiniExcel/blob/master/samples/xlsx/Test1%2C000%2C000x10/Test1%2C000%2C000x10.xlsx) 做基准与主流框架做性能测试,总共 1千万笔 "HelloWorld",文件大小 23 MB
以 [**Test1,000,000x10.xlsx**](https://github.com/shps951023/MiniExcel/blob/master/samples/xlsx/Test1%2C000%2C000x10.xlsx) 做基准与主流框架做性能测试,总共 1千万笔 "HelloWorld",文件大小 23 MB
Benchmarks 逻辑可以在 [MiniExcel.Benchmarks](https://github.com/shps951023/MiniExcel/tree/master/benchmarks/MiniExcel.Benchmarks) 查看或是提交 PR运行指令

View File

@ -49,7 +49,7 @@ MiniExcel 簡單、高效避免OOM的.NET處理Excel查、寫、填充工具。
### 性能測試
以 [**Test1,000,000x10.xlsx**](https://github.com/shps951023/MiniExcel/blob/master/samples/xlsx/Test1%2C000%2C000x10/Test1%2C000%2C000x10.xlsx) 做基準與主流框架做性能測試,總共 1千萬筆 "HelloWorld",檔案大小 23 MB
以 [**Test1,000,000x10.xlsx**](https://github.com/shps951023/MiniExcel/blob/master/samples/xlsx/Test1%2C000%2C000x10.xlsx) 做基準與主流框架做性能測試,總共 1千萬筆 "HelloWorld",檔案大小 23 MB
Benchmarks 邏輯可以在 [MiniExcel.Benchmarks](https://github.com/shps951023/MiniExcel/tree/master/benchmarks/MiniExcel.Benchmarks) 查看或是提交 PR運行指令

View File

@ -18,4 +18,25 @@
<ProjectReference Include="..\..\src\MiniExcel\MiniExcelLibs.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="Test10,000x10.xlsx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Test100,000x10.xlsx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Test10x10.xlsx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Test100x10.xlsx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="TestTemplateBasicIEmumerableFill.xlsx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="TestTemplateBasicIEmumerableFill_ClosedXML_Report.xlsx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@ -24,14 +24,10 @@ namespace MiniExcelLibs.Benchmarks
static void Main(string[] args)
{
#if !DEBUG
//new BenchmarkSwitcher(typeof(Program).Assembly).Run(args, new Config());
//BenchmarkRunner.Run<XlsxBenchmark>();
BenchmarkRunner.Run<TemplateXlsxBenchmark>();
BenchmarkSwitcher.FromTypes(new[]{typeof(XlsxBenchmark)}).Run(args, new Config());
#else
//BenchmarkSwitcher.FromTypes(new[] { typeof(TemplateXlsxBenchmark) }).Run(args, new DebugInProcessConfig() );
//BenchmarkSwitcher.FromAssembly(typeof(TemplateXlsxBenchmark).Assembly).Run(args, new DebugConfig());
new TemplateXlsxBenchmark().MiniExcel_Template_Generate_Test();
BenchmarkSwitcher.FromTypes(new[] { typeof(XlsxBenchmark) }).Run(args, new DebugInProcessConfig() );
//new TemplateXlsxBenchmark().MiniExcel_Template_Generate_Test();
//new XlsxBenchmark().MiniExcelCreateTest();
#endif
Console.Read();
@ -45,25 +41,44 @@ namespace MiniExcelLibs.Benchmarks
public abstract class BenchmarkBase
{
#if !DEBUG
public const string filePath = @"D:\git\MiniExcel\samples\xlsx\Test1,000,000x10\Test1,000,000x10.xlsx";
//public const string filePath = @"D:\git\MiniExcel\samples\xlsx\Test10x10.xlsx";
public const string filePath = @"Test10,000x10.xlsx";
public const int runCount = 1_000_000;
#else
public const string filePath = @"D:\git\MiniExcel\samples\xlsx\Test1,000,000x10\Test1,000,000x10.xlsx";
//public const string filePath = @"D:\git\MiniExcel\samples\xlsx\Test10x10.xlsx";
public const string filePath = @"Test100x10.xlsx";
public const int runCount = 10;
#endif
//public const string filePath = @"Test10x10.xlsx";
//public const int runCount = 10;
public static IEnumerable<Demo> GetValues()
{
#if !DEBUG
return Enumerable.Range(1, runCount).Select(s => new Demo());
#else
return Enumerable.Range(1, runCount).Select(s => new Demo());
#endif
}
}
public class TemplateXlsxBenchmark : BenchmarkBase
public class XlsxBenchmark: BenchmarkBase
{
[GlobalSetup]
public void SetUp()
{
ExcelPackage.LicenseContext = OfficeOpenXml.LicenseContext.NonCommercial;
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
}
[Benchmark(Description = "MiniExcel Template Generate")]
public void MiniExcel_Template_Generate_Test()
{
{
var path = Path.Combine(Path.GetTempPath(), $"{Guid.NewGuid().ToString()}.xlsx");
var templatePath = @"D:\git\MiniExcel\samples\xlsx\TestTemplateBasicIEmumerableFill.xlsx";
const string templatePath = @"TestTemplateBasicIEmumerableFill.xlsx";
var value = new
{
employees = Enumerable.Range(1, 1000000).Select(s => new { name = "Jack", department = "HR" })
employees = Enumerable.Range(1, runCount).Select(s => new { name = "Jack", department = "HR" })
};
MiniExcel.SaveAsByTemplate(path, templatePath, value);
}
@ -74,28 +89,17 @@ namespace MiniExcelLibs.Benchmarks
{
{
var path = Path.Combine(Path.GetTempPath(), $"{Guid.NewGuid().ToString()}.xlsx");
var templatePath = @"D:\git\MiniExcel\samples\xlsx\TestTemplateBasicIEmumerableFill_ClosedXML_Report.xlsx";
var templatePath = @"TestTemplateBasicIEmumerableFill_ClosedXML_Report.xlsx";
var template = new ClosedXML.Report.XLTemplate(templatePath);
var value = new
{
employees = Enumerable.Range(1, 1000000).Select(s => new { name = "Jack", department = "HR" })
employees = Enumerable.Range(1, runCount).Select(s => new { name = "Jack", department = "HR" })
};
template.AddVariable(value);
template.Generate();
template.SaveAs(path);
}
}
}
public class XlsxBenchmark: BenchmarkBase
{
[GlobalSetup]
public void SetUp()
{
ExcelPackage.LicenseContext = OfficeOpenXml.LicenseContext.NonCommercial;
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
}
[Benchmark(Description = "MiniExcel QueryFirst")]
public void MiniExcel_QueryFirst_Test()
@ -318,28 +322,19 @@ namespace MiniExcelLibs.Benchmarks
}
File.Delete(path);
}
}
private static IEnumerable<Demo> GetValues()
{
#if !DEBUG
return Enumerable.Range(1, 1000000).Select(s => new Demo());
#else
return Enumerable.Range(1, 1000000).Select(s => new Demo());
#endif
}
public class Demo
{
public string Text1 { get; set; } = "Hello World";
public string Text2 { get; set; } = "Hello World";
public string Text3 { get; set; } = "Hello World";
public string Text4 { get; set; } = "Hello World";
public string Text5 { get; set; } = "Hello World";
public string Text6 { get; set; } = "Hello World";
public string Text7 { get; set; } = "Hello World";
public string Text8 { get; set; } = "Hello World";
public string Text9 { get; set; } = "Hello World";
public string Text10 { get; set; } = "Hello World";
}
public class Demo
{
public string Text1 { get; set; } = "Hello World";
public string Text2 { get; set; } = "Hello World";
public string Text3 { get; set; } = "Hello World";
public string Text4 { get; set; } = "Hello World";
public string Text5 { get; set; } = "Hello World";
public string Text6 { get; set; } = "Hello World";
public string Text7 { get; set; } = "Hello World";
public string Text8 { get; set; } = "Hello World";
public string Text9 { get; set; } = "Hello World";
public string Text10 { get; set; } = "Hello World";
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -354,7 +354,7 @@ namespace MiniExcelLibs.Tests
[Fact()]
public void LargeFileQueryStrongTypeMapping_Test()
{
var path = @"../../../../../samples/xlsx/Test1,000,000x10/Test1,000,000x10.xlsx";
var path = @"../../../../../benchmarks/MiniExcel.Benchmarks/Test1,000,000x10.xlsx";
using (var stream = File.OpenRead(path))
{
var rows = stream.Query<DemoPocoHelloWorld>().Take(2).ToList();
@ -713,7 +713,7 @@ namespace MiniExcelLibs.Tests
[Fact()]
public void QueryByLINQExtensionsAvoidLargeFileOOMTest()
{
var path = @"../../../../../samples/xlsx/Test1,000,000x10/Test1,000,000x10.xlsx";
var path = "../../../../../benchmarks/MiniExcel.Benchmarks/Test1,000,000x10.xlsx";
{
var row = MiniExcel.Query(path).First();