mirror of
https://gitee.com/dotnetchina/MiniExcel.git
synced 2024-11-30 02:47:39 +08:00
cc6a296d22
drafts\【ExcelDataReader】Read Large Xlsx File.linq drafts\【MiniExcel】Read Large Xlsx File.linq samples\csv\TestLargeFile_1,000,000.csv
48 lines
1.8 KiB
C#
48 lines
1.8 KiB
C#
<Query Kind="Program">
|
|
<NuGetReference>Dapper</NuGetReference>
|
|
<NuGetReference>MiniExcel</NuGetReference>
|
|
<NuGetReference>System.Data.SqlClient</NuGetReference>
|
|
<Namespace>MiniExcelLibs</Namespace>
|
|
<Namespace>Xunit</Namespace>
|
|
<RemoveNamespace>System.Collections</RemoveNamespace>
|
|
<RemoveNamespace>System.Collections.Generic</RemoveNamespace>
|
|
<RemoveNamespace>System.Data</RemoveNamespace>
|
|
<RemoveNamespace>System.Linq</RemoveNamespace>
|
|
<RemoveNamespace>System.Linq.Expressions</RemoveNamespace>
|
|
<RemoveNamespace>System.Reflection</RemoveNamespace>
|
|
<RemoveNamespace>System.Text</RemoveNamespace>
|
|
<RemoveNamespace>System.Text.RegularExpressions</RemoveNamespace>
|
|
<RemoveNamespace>System.Threading</RemoveNamespace>
|
|
<RemoveNamespace>System.Transactions</RemoveNamespace>
|
|
<RemoveNamespace>System.Xml</RemoveNamespace>
|
|
<RemoveNamespace>System.Xml.Linq</RemoveNamespace>
|
|
<RemoveNamespace>System.Xml.XPath</RemoveNamespace>
|
|
</Query>
|
|
|
|
#load "xunit"
|
|
|
|
void Main()
|
|
{
|
|
Stopwatch sw = new Stopwatch();
|
|
sw.Start();
|
|
Console.WriteLine("start memory usage: " + System.Diagnostics.Process.GetCurrentProcess().WorkingSet64 / (1024 * 1024) + $"MB");
|
|
|
|
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
|
|
var path = @"D:\git\MiniExcel\samples\xlsx\Test1,000,000x10\Test1,000,000x10.xlsx";
|
|
using (var stream = File.OpenRead(path))
|
|
{
|
|
var i = 0;
|
|
foreach (var v in stream.Query())
|
|
{
|
|
Assert.Equal(v, v);
|
|
i++;
|
|
if (i % 100000 == 0)
|
|
{
|
|
Console.WriteLine($"time.{i} memory usage: " + System.Diagnostics.Process.GetCurrentProcess().WorkingSet64 / (1024 * 1024) + $"MB & run time : {sw.ElapsedMilliseconds}ms");
|
|
}
|
|
}
|
|
Console.WriteLine("end memory usage: " + System.Diagnostics.Process.GetCurrentProcess().WorkingSet64 / (1024 * 1024) + $"MB & run time : {sw.ElapsedMilliseconds}ms");
|
|
}
|
|
}
|
|
|