Magicodes.IE 在100万数据量下导入导出性能测试

时间:2022-02-21 04:20:27

原文作者:HueiFeng

前言

目前Magicodes.IE更新到了2.2.3,感谢大家的支持,同时建议大家在使用过程中如果遇到一些问题或者说需要一些额外的功能可以直接提issues,当然更建议大家提PR。

近期更新

2020.05.24

  • 【Nuget】版本更新到2.2.2

  • 【Excel导入】增加了stream导入扩展方法

  • 【Excel导出】增加了内容居中(单列居中、整表居中)

  • 【导出】对一些中间件代码进行了修复及优化

2020.05.16

  • 【Nuget】版本更新到2.2.1

  • 【PDF导出】对模板引擎进行升级更新

2020.05.12

  • 【Nuget】版本更新到2.2.0

  • 【Excel模板导出】支持导出字节

  • 【文档】Magicodes.IE Csv导入导出

  • 【Excel导入导出】修复标注的添加问题

  • 【导出】ASP.NET Core Web API 中使用自定义格式化程序导出Excel、Pdf、Csv等内容 #64

  • 【导入导出】支持使用System.ComponentModel.DataAnnotations命名空间下的部分特性来控制导入导出 #63

性能测试

电脑配置以及环境如下所示:


BenchmarkDotNet=v0.12.1, OS=Windows 10.0.18363.836 (/November2018Update/19H2)
AMD Ryzen 3600X, CPU, logical and physical cores
.NET Core SDK=5.0.-preview.4.20258.
[Host] : .NET Core 3.1. (CoreCLR 4.700.20.20201, CoreFX 4.700.20.22101), X64 RyuJIT
Job-OONFAJ : .NET Framework 4.8 (4.8.4180.0), X64 RyuJIT
Job-YIUEXF : .NET Core 2.2. (CoreCLR 4.6.28207.03, CoreFX 4.6.28208.02), X64 RyuJIT
Job-LZHMKS : .NET Core 3.1. (CoreCLR 4.700.20.20201, CoreFX 4.700.20.22101), X64 RyuJIT

IterationCount= LaunchCount= WarmupCount=

Excel & Csv 导出

Excel导出如下所示:

Method Job Runtime RowsCount Mean Error StdDev
ExportExcelAsByteArrayTest Job-OONFAJ .NET 4.6.1 10000 153.1 ms 5.52 ms 0.85 ms
ExportExcelAsByteArrayTest Job-YIUEXF .NET Core 2.2 10000 138.0 ms 1.53 ms 0.40 ms
ExportExcelAsByteArrayTest Job-LZHMKS .NET Core 3.1 10000 143.0 ms 9.86 ms 1.53 ms
ExportExcelAsByteArrayTest Job-OONFAJ .NET 4.6.1 120000 1,904.2 ms 98.37 ms 25.55 ms
ExportExcelAsByteArrayTest Job-YIUEXF .NET Core 2.2 120000 1,662.8 ms 132.04 ms 20.43 ms
ExportExcelAsByteArrayTest Job-LZHMKS .NET Core 3.1 120000 1,636.1 ms 99.64 ms 25.88 ms
ExportExcelAsByteArrayTest Job-OONFAJ .NET 4.6.1 240000 3,688.3 ms 58.52 ms 15.20 ms
ExportExcelAsByteArrayTest Job-YIUEXF .NET Core 2.2 240000 3,268.1 ms 138.16 ms 21.38 ms
ExportExcelAsByteArrayTest Job-LZHMKS .NET Core 3.1 240000 3,223.9 ms 70.93 ms 10.98 ms
ExportExcelAsByteArrayTest Job-OONFAJ .NET 4.6.1 500000 7,723.4 ms 179.06 ms 46.50 ms
ExportExcelAsByteArrayTest Job-YIUEXF .NET Core 2.2 500000 6,959.7 ms 481.61 ms 125.07 ms
ExportExcelAsByteArrayTest Job-LZHMKS .NET Core 3.1 500000 6,833.2 ms 331.74 ms 86.15 ms
ExportExcelAsByteArrayTest Job-OONFAJ .NET 4.6.1 1000000 15,443.7 ms 582.64 ms 151.31 ms
ExportExcelAsByteArrayTest Job-YIUEXF .NET Core 2.2 1000000 13,798.9 ms 207.09 ms 32.05 ms
ExportExcelAsByteArrayTest Job-LZHMKS .NET Core 3.1 1000000 13,484.1 ms 424.85 ms 110.33 ms

Csv导出如下所示:

Method Job Runtime RowsCount Mean Error StdDev
ExportCsvAsByteArrayTest Job-SRSOYE .NET 4.6.1 10000 30.43 ms 2.493 ms 0.647 ms
ExportCsvAsByteArrayTest Job-WLDFBY .NET Core 2.2 10000 30.12 ms 5.981 ms 1.553 ms
ExportCsvAsByteArrayTest Job-JSEPRQ .NET Core 3.1 10000 24.53 ms 0.142 ms 0.022 ms
ExportCsvAsByteArrayTest Job-SRSOYE .NET 4.6.1 120000 345.51 ms 16.385 ms 4.255 ms
ExportCsvAsByteArrayTest Job-WLDFBY .NET Core 2.2 120000 330.03 ms 16.025 ms 4.162 ms
ExportCsvAsByteArrayTest Job-JSEPRQ .NET Core 3.1 120000 287.98 ms 11.898 ms 3.090 ms
ExportCsvAsByteArrayTest Job-SRSOYE .NET 4.6.1 240000 687.57 ms 10.379 ms 2.695 ms
ExportCsvAsByteArrayTest Job-WLDFBY .NET Core 2.2 240000 656.00 ms 13.741 ms 2.126 ms
ExportCsvAsByteArrayTest Job-JSEPRQ .NET Core 3.1 240000 560.43 ms 12.721 ms 3.304 ms
ExportCsvAsByteArrayTest Job-SRSOYE .NET 4.6.1 500000 1,478.88 ms 31.074 ms 8.070 ms
ExportCsvAsByteArrayTest Job-WLDFBY .NET Core 2.2 500000 1,379.52 ms 20.652 ms 5.363 ms
ExportCsvAsByteArrayTest Job-JSEPRQ .NET Core 3.1 500000 1,182.48 ms 39.358 ms 10.221 ms
ExportCsvAsByteArrayTest Job-SRSOYE .NET 4.6.1 1000000 2,918.99 ms 43.023 ms 6.658 ms
ExportCsvAsByteArrayTest Job-WLDFBY .NET Core 2.2 1000000 2,751.29 ms 19.970 ms 5.186 ms
ExportCsvAsByteArrayTest Job-JSEPRQ .NET Core 3.1 1000000 2,332.39 ms 57.988 ms 8.974 ms

Excel & Csv 导入

Excel导入如下所示:

Method Job Runtime RowsCount Mean Error StdDev
ImportByStreamTest Job-URKTYJ .NET 4.6.1 10000 711.4 μs 136.2 μs 35.37 μs
ImportByStreamTest Job-AFBGUZ .NET Core 2.2 10000 746.2 μs 131.8 μs 20.40 μs
ImportByStreamTest Job-DUXAFG .NET Core 3.1 10000 792.4 μs 186.5 μs 48.42 μs
ImportByStreamTest Job-URKTYJ .NET 4.6.1 120000 2,297.6 μs 181.3 μs 47.08 μs
ImportByStreamTest Job-AFBGUZ .NET Core 2.2 120000 2,139.5 μs 204.5 μs 53.12 μs
ImportByStreamTest Job-DUXAFG .NET Core 3.1 120000 2,035.8 μs 304.8 μs 47.17 μs
ImportByStreamTest Job-URKTYJ .NET 4.6.1 240000 5,378.2 μs 887.9 μs 230.59 μs
ImportByStreamTest Job-AFBGUZ .NET Core 2.2 240000 5,345.6 μs 989.9 μs 257.08 μs
ImportByStreamTest Job-DUXAFG .NET Core 3.1 240000 4,672.5 μs 1,004.5 μs 260.86 μs
ImportByStreamTest Job-URKTYJ .NET 4.6.1 500000 11,336.6 μs 657.3 μs 170.69 μs
ImportByStreamTest Job-AFBGUZ .NET Core 2.2 500000 10,833.4 μs 952.9 μs 247.45 μs
ImportByStreamTest Job-DUXAFG .NET Core 3.1 500000 10,525.7 μs 561.0 μs 145.69 μs
ImportByStreamTest Job-URKTYJ .NET 4.6.1 1000000 21,965.7 μs 1,058.5 μs 274.88 μs
ImportByStreamTest Job-AFBGUZ .NET Core 2.2 1000000 20,612.1 μs 628.2 μs 163.14 μs
ImportByStreamTest Job-DUXAFG .NET Core 3.1 1000000 20,451.1 μs 3,807.7 μs 988.84 μs

Csv导入如下所示:

Method Job Runtime RowsCount Mean Error StdDev
ImportByStreamTest Job-OPUXWE .NET 4.6.1 10000 294.1 μs 1.99 μs 0.31 μs
ImportByStreamTest Job-OVPAAE .NET Core 2.2 10000 283.7 μs 3.54 μs 0.55 μs
ImportByStreamTest Job-AMXXYD .NET Core 3.1 10000 284.5 μs 1.77 μs 0.46 μs
ImportByStreamTest Job-OPUXWE .NET 4.6.1 120000 2,116.1 μs 13.28 μs 2.05 μs
ImportByStreamTest Job-OVPAAE .NET Core 2.2 120000 1,855.8 μs 80.59 μs 20.93 μs
ImportByStreamTest Job-AMXXYD .NET Core 3.1 120000 1,849.3 μs 186.63 μs 48.47 μs
ImportByStreamTest Job-OPUXWE .NET 4.6.1 240000 5,121.9 μs 270.99 μs 70.37 μs
ImportByStreamTest Job-OVPAAE .NET Core 2.2 240000 4,448.3 μs 84.91 μs 13.14 μs
ImportByStreamTest Job-AMXXYD .NET Core 3.1 240000 4,301.9 μs 78.77 μs 20.46 μs
ImportByStreamTest Job-OPUXWE .NET 4.6.1 500000 11,245.2 μs 120.46 μs 18.64 μs
ImportByStreamTest Job-OVPAAE .NET Core 2.2 500000 10,214.1 μs 113.20 μs 29.40 μs
ImportByStreamTest Job-AMXXYD .NET Core 3.1 500000 10,460.1 μs 90.90 μs 23.61 μs
ImportByStreamTest Job-OPUXWE .NET 4.6.1 1000000 21,807.0 μs 299.03 μs 46.28 μs
ImportByStreamTest Job-OVPAAE .NET Core 2.2 1000000 19,830.9 μs 186.01 μs 48.30 μs
ImportByStreamTest Job-AMXXYD .NET Core 3.1 1000000 20,051.3 μs 395.98 μs 102.83 μs

Reference

https://github.com/dotnetcore/Magicodes.IE

原文作者:HueiFeng