ไลบรารี. NET Core ที่ง่ายมากที่สามารถช่วยซิงค์บันทึกจำนวนมากในหน่วยความจำลงในฐานข้อมูลโดยใช้คลาส SQLBULKCOPY
ไลบรารีนี้มีวิธีการขยายเพื่อให้คุณสามารถใช้กับ EntityFrameworkCore DBContext อินสแตนซ์ dbContextextensions.cs หรือคุณสามารถใช้ sqlconnectionextensions.cs เพื่อทำงานโดยตรงกับอินสแตนซ์ sqlconnection โดยไม่ต้องใช้ EntityFrameworkCore
https://www.nuget.org/packages/entityframeworkcore.sqlserver.simplebulks
EntityFrameworkcore.sqlserver.simplebulks.demo
private const string _connectionString = "Server=.;Database=SimpleBulks;User Id=xxx;Password=xxx" ; using EntityFrameworkCore . SqlServer . SimpleBulks . BulkDelete ;
using EntityFrameworkCore . SqlServer . SimpleBulks . BulkInsert ;
using EntityFrameworkCore . SqlServer . SimpleBulks . BulkMerge ;
using EntityFrameworkCore . SqlServer . SimpleBulks . BulkUpdate ;
// Insert all columns
dbct . BulkInsert ( rows ) ;
dbct . BulkInsert ( compositeKeyRows ) ;
// Insert selected columns only
dbct . BulkInsert ( rows ,
row => new { row . Column1 , row . Column2 , row . Column3 } ) ;
dbct . BulkInsert ( compositeKeyRows ,
row => new { row . Id1 , row . Id2 , row . Column1 , row . Column2 , row . Column3 } ) ;
dbct . BulkUpdate ( rows ,
row => new { row . Column3 , row . Column2 } ) ;
dbct . BulkUpdate ( compositeKeyRows ,
row => new { row . Column3 , row . Column2 } ) ;
dbct . BulkMerge ( rows ,
row => row . Id ,
row => new { row . Column1 , row . Column2 } ,
row => new { row . Column1 , row . Column2 , row . Column3 } ) ;
dbct . BulkMerge ( compositeKeyRows ,
row => new { row . Id1 , row . Id2 } ,
row => new { row . Column1 , row . Column2 , row . Column3 } ,
row => new { row . Id1 , row . Id2 , row . Column1 , row . Column2 , row . Column3 } ) ;
dbct . BulkDelete ( rows ) ;
dbct . BulkDelete ( compositeKeyRows ) ; using EntityFrameworkCore . SqlServer . SimpleBulks . BulkDelete ;
using EntityFrameworkCore . SqlServer . SimpleBulks . BulkInsert ;
using EntityFrameworkCore . SqlServer . SimpleBulks . BulkMerge ;
using EntityFrameworkCore . SqlServer . SimpleBulks . BulkUpdate ;
dbct . BulkUpdate ( rows ,
[ "Column3" , "Column2" ] ) ;
dbct . BulkUpdate ( compositeKeyRows ,
[ "Column3" , "Column2" ] ) ;
dbct . BulkMerge ( rows ,
"Id" ,
[ "Column1" , "Column2" ] ,
[ "Column1" , "Column2" , "Column3" ] ) ;
dbct . BulkMerge ( compositeKeyRows ,
[ "Id1" , "Id2" ] ,
[ "Column1" , "Column2" , "Column3" ] ,
[ "Id1" , "Id2" , "Column1" , "Column2" , "Column3" ] ) ; new BulkInsertBuilder < Row > ( dbct . GetSqlConnection ( ) )
. WithColumns ( row => new { row . Column1 , row . Column2 , row . Column3 } )
// or .WithColumns([ "Column1", "Column2", "Column3" ])
. WithOutputId ( row => row . Id )
// or .WithOutputId("Id")
. ToTable ( dbct . GetTableName ( typeof ( Row ) ) )
// or .ToTable("Rows")
. Execute ( rows ) ; using EntityFrameworkCore . SqlServer . SimpleBulks . BulkDelete ;
using EntityFrameworkCore . SqlServer . SimpleBulks . BulkInsert ;
using EntityFrameworkCore . SqlServer . SimpleBulks . BulkMerge ;
using EntityFrameworkCore . SqlServer . SimpleBulks . BulkUpdate ;
// Register Type - Table Name globaly
TableMapper . Register ( typeof ( Row ) , "Rows" ) ;
TableMapper . Register ( typeof ( CompositeKeyRow ) , "CompositeKeyRows" ) ;
connection . BulkInsert ( rows ,
row => new { row . Column1 , row . Column2 , row . Column3 } ) ;
connection . BulkInsert ( compositeKeyRows ,
row => new { row . Id1 , row . Id2 , row . Column1 , row . Column2 , row . Column3 } ) ;
connection . BulkUpdate ( rows ,
row => row . Id ,
row => new { row . Column3 , row . Column2 } ) ;
connection . BulkUpdate ( compositeKeyRows ,
row => new { row . Id1 , row . Id2 } ,
row => new { row . Column3 , row . Column2 } ) ;
connection . BulkMerge ( rows ,
row => row . Id ,
row => new { row . Column1 , row . Column2 } ,
row => new { row . Column1 , row . Column2 , row . Column3 } ) ;
connection . BulkMerge ( compositeKeyRows ,
row => new { row . Id1 , row . Id2 } ,
row => new { row . Column1 , row . Column2 , row . Column3 } ,
row => new { row . Id1 , row . Id2 , row . Column1 , row . Column2 , row . Column3 } ) ;
connection . BulkDelete ( rows , row => row . Id ) ;
connection . BulkDelete ( compositeKeyRows , row => new { row . Id1 , row . Id2 } ) ; using EntityFrameworkCore . SqlServer . SimpleBulks . BulkDelete ;
using EntityFrameworkCore . SqlServer . SimpleBulks . BulkInsert ;
using EntityFrameworkCore . SqlServer . SimpleBulks . BulkMerge ;
using EntityFrameworkCore . SqlServer . SimpleBulks . BulkUpdate ;
connection . BulkInsert ( rows , "Rows" ,
[ "Column1" , "Column2" , "Column3" ] ) ;
connection . BulkInsert ( rows . Take ( 1000 ) , "Rows" ,
typeof ( Row ) . GetDbColumnNames ( "Id" ) ) ;
connection . BulkInsert ( compositeKeyRows , "CompositeKeyRows" ,
[ "Id1" , "Id2" , "Column1" , "Column2" , "Column3" ] ) ;
connection . BulkUpdate ( rows , "Rows" ,
"Id" ,
[ "Column3" , "Column2" ] ) ;
connection . BulkUpdate ( compositeKeyRows , "CompositeKeyRows" ,
[ "Id1" , "Id2" ] ,
[ "Column3" , "Column2" ] ) ;
connection . BulkMerge ( rows , "Rows" ,
"Id" ,
[ "Column1" , "Column2" ] ,
[ "Column1" , "Column2" , "Column3" ] ) ;
connection . BulkMerge ( compositeKeyRows , "CompositeKeyRows" ,
[ "Id1" , "Id2" ] ,
[ "Column1" , "Column2" , "Column3" ] ,
[ "Id1" , "Id2" , "Column1" , "Column2" , "Column3" ] ) ;
connection . BulkDelete ( rows , "Rows" , "Id" ) ;
connection . BulkDelete ( compositeKeyRows , "CompositeKeyRows" , [ "Id1" , "Id2" ] ) ; new BulkInsertBuilder < Row > ( connection )
. WithColumns ( row => new { row . Column1 , row . Column2 , row . Column3 } )
// or .WithColumns([ "Column1", "Column2", "Column3" ])
. WithOutputId ( row => row . Id )
// or .WithOutputId("Id")
. ToTable ( "Rows" )
. Execute ( rows ) ; _context . BulkInsert ( rows ,
row => new { row . Column1 , row . Column2 , row . Column3 } ,
options =>
{
options . KeepIdentity = false ;
options . BatchSize = 0 ;
options . Timeout = 30 ;
options . LogTo = Console . WriteLine ;
} ) ; _context . BulkUpdate ( rows ,
row => new { row . Column3 , row . Column2 } ,
options =>
{
options . BatchSize = 0 ;
options . Timeout = 30 ;
options . LogTo = Console . WriteLine ;
} ) ; _context . BulkDelete ( rows ,
options =>
{
options . BatchSize = 0 ;
options . Timeout = 30 ;
options . LogTo = Console . WriteLine ;
} ) ; _context . BulkMerge ( rows ,
row => row . Id ,
row => new { row . Column1 , row . Column2 } ,
row => new { row . Column1 , row . Column2 , row . Column3 } ,
options =>
{
options . BatchSize = 0 ;
options . Timeout = 30 ;
options . WithHoldLock = false ;
options . ReturnDbGeneratedId = true ;
options . LogTo = Console . WriteLine ;
} ) ; var contactsFromDb = _context . BulkMatch ( matchedContacts ,
x => new { x . CustomerId , x . CountryIsoCode } ,
options =>
{
options . BatchSize = 0 ;
options . Timeout = 30 ;
options . LogTo = Console . WriteLine ;
} ) ; var customerTableName = _context . CreateTempTable ( customers ,
x => new
{
x . IdNumber ,
x . FirstName ,
x . LastName ,
x . CurrentCountryIsoCode
} ,
options =>
{
options . BatchSize = 0 ;
options . Timeout = 30 ;
options . LogTo = Console . WriteLine ;
} ) ; _context . DirectInsert ( row ,
row => new { row . Column1 , row . Column2 , row . Column3 } ,
options =>
{
options . Timeout = 30 ;
options . LogTo = Console . WriteLine ;
} ) ; _context . DirectUpdate ( row ,
row => new { row . Column3 , row . Column2 } ,
options =>
{
options . Timeout = 30 ;
options . LogTo = Console . WriteLine ;
} ) ; _context . DirectDelete ( row ,
options =>
{
options . Timeout = 30 ;
options . LogTo = Console . WriteLine ;
} ) ; var updateResult = dbct . BulkUpdate ( rows , row => new { row . Column3 , row . Column2 } ) ;
Console . WriteLine ( $ "Updated: { updateResult . AffectedRows } row(s)" ) ; var deleteResult = dbct . BulkDelete ( rows ) ;
Console . WriteLine ( $ "Deleted: { deleteResult . AffectedRows } row(s)" ) ; var mergeResult = dbct . BulkMerge ( rows ,
row => row . Id ,
row => new { row . Column1 , row . Column2 } ,
row => new { row . Column1 , row . Column2 , row . Column3 } ) ;
Console . WriteLine ( $ "Updated: { mergeResult . UpdatedRows } row(s)" ) ;
Console . WriteLine ( $ "Inserted: { mergeResult . InsertedRows } row(s)" ) ;
Console . WriteLine ( $ "Affected: { mergeResult . AffectedRows } row(s)" ) ; ตารางเดี่ยว /src/entityframeworkcore.sqlserver.simplebulks.benchmarks/bulkinsertsingletablebenchmarks.cs
BenchmarkDotNet =v0.13.2, OS =Windows 10 (10.0.19045.5011)
11th Gen Intel Core i7-1165G7 2.80GHz, 1 CPU, 8 logical and 4 physical cores
.NET SDK =8.0.400
[Host] : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
Job-LGAVYD : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
InvocationCount =1 IterationCount =1 UnrollFactor =1
WarmupCount =0
| วิธี | Rowscount | หมายถึง | ข้อผิดพลาด | Gen0 | Gen1 | Gen2 | จัดสรร |
|---|---|---|---|---|---|---|---|
| EfcoreInsert | 100 | 45.19 ms | นา | - | - | - | 985.52 KB |
| จำนวนมาก | 100 | 32.68 ms | นา | - | - | - | 93.78 kb |
| EfcoreInsert | 1,000 | 145.41 ms | นา | 1,000.0000 | - | - | 9702.7 KB |
| จำนวนมาก | 1,000 | 44.94 ms | นา | - | - | - | 573.84 KB |
| EfcoreInsert | 10,000 | 788.90 ms | นา | 14000.0000 | 5000.0000 | - | 95727.38 KB |
| จำนวนมาก | 10,000 | 126.36 ms | นา | - | - | - | 5320.53 KB |
| EfcoreInsert | 100000 | 7,107.29 ms | นา | 146000.0000 | 36000.0000 | - | 950162.56 KB |
| จำนวนมาก | 100000 | 998.42 ms | นา | 7000.0000 | 3000.0000 | 1,000.0000 | 51730.81 KB |
| EfcoreInsert | 250000 | 18,542.56 ms | นา | 365000.0000 | 87000.0000 | - | 2352262.34 KB |
| จำนวนมาก | 250000 | 2,576.88 ms | นา | 16000.0000 | 5000.0000 | 1,000.0000 | 125832.63 KB |
| EfcoreInsert | 500000 | 34,957.34 ms | นา | 730000.0000 | 170000.0000 | - | 4711772.88 KB |
| จำนวนมาก | 500000 | 5,553.61 ms | นา | 30000.0000 | 9000.0000 | 1,000.0000 | 252707.77 KB |
หลายตาราง (แถวพาเรนต์ 1x + แถวเด็ก 5x) /src/entityframeworkcore.sqlserver.simplebulks.benchmarks/bulkinsertMultipleTablesBenchmarks.cs
BenchmarkDotNet =v0.13.2, OS =Windows 10 (10.0.19045.5011)
11th Gen Intel Core i7-1165G7 2.80GHz, 1 CPU, 8 logical and 4 physical cores
.NET SDK =8.0.400
[Host] : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
Job-LGAVYD : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
InvocationCount =1 IterationCount =1 UnrollFactor =1
WarmupCount =0
| วิธี | Rowscount | หมายถึง | ข้อผิดพลาด | Gen0 | Gen1 | Gen2 | จัดสรร |
|---|---|---|---|---|---|---|---|
| EfcoreInsert | 100 | 226.22 ms | นา | 1,000.0000 | - | - | 7438.51 KB |
| จำนวนมาก | 100 | 48.38 ms | นา | - | - | - | 444.18 KB |
| EfcoreInsert | 1,000 | 566.95 ms | นา | 11000.0000 | 4000.0000 | - | 73518.48 KB |
| จำนวนมาก | 1,000 | 125.77 ms | นา | - | - | - | 3460.21 KB |
| EfcoreInsert | 10,000 | 6,268.42 มิลลิวินาที | นา | 114000.0000 | 30000.0000 | - | 731076.92 KB |
| จำนวนมาก | 10,000 | 1,066.74 มิลลิวินาที | นา | 5000.0000 | 2000.0000 | 1,000.0000 | 33324.16 KB |
| EfcoreInsert | 100000 | 59,389.89 ms | นา | 1138000.0000 | 264000.0000 | - | 7282561.93 KB |
| จำนวนมาก | 100000 | 9,504.12 มิลลิวินาที | นา | 39000.0000 | 13000.0000 | 1,000.0000 | 327100.08 KB |
/src/entityframeworkcore.sqlserver.simplebulks.benchmarks/bulkupdatebenchmarks.cs
BenchmarkDotNet =v0.13.2, OS =Windows 10 (10.0.19045.5011)
11th Gen Intel Core i7-1165G7 2.80GHz, 1 CPU, 8 logical and 4 physical cores
.NET SDK =8.0.400
[Host] : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
Job-LGAVYD : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
InvocationCount =1 IterationCount =1 UnrollFactor =1
WarmupCount =0
| วิธี | Rowscount | หมายถึง | ข้อผิดพลาด | Gen0 | Gen1 | จัดสรร |
|---|---|---|---|---|---|---|
| efcoreupdate | 100 | 61.65 ms | นา | - | - | 853.66 KB |
| มีจำนวนมาก | 100 | 27.33 ms | นา | - | - | 63.55 kb |
| efcoreupdate | 1,000 | 143.39 ms | นา | 1,000.0000 | - | 8398.1 KB |
| มีจำนวนมาก | 1,000 | 43.95 ms | นา | - | - | 379.25 KB |
| efcoreupdate | 10,000 | 685.97 ms | นา | 12000.0000 | 3000.0000 | 82396.19 KB |
| มีจำนวนมาก | 10,000 | 182.54 ms | นา | - | - | 3499.74 KB |
| efcoreupdate | 100000 | 8,495.18 ms | นา | 120000.0000 | 28000.0000 | 810248.07 KB |
| มีจำนวนมาก | 100000 | 2,091.42 มิลลิวินาที | นา | 5000.0000 | 1,000.0000 | 33819.46 KB |
| efcoreupdate | 250000 | 17,859.49 มิลลิวินาที | นา | 300000.0000 | 69000.0000 | 2005895.77 KB |
| มีจำนวนมาก | 250000 | 4,290.07 ms | นา | 13000.0000 | 7000.0000 | 84352 KB |
BenchmarkDotNet =v0.13.2, OS =Windows 10 (10.0.19045.5011)
11th Gen Intel Core i7-1165G7 2.80GHz, 1 CPU, 8 logical and 4 physical cores
.NET SDK =8.0.400
[Host] : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
Job-LGAVYD : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
InvocationCount =1 IterationCount =1 UnrollFactor =1
WarmupCount =0
| วิธี | Rowscount | หมายถึง | ข้อผิดพลาด | Gen0 | Gen1 | จัดสรร |
|---|---|---|---|---|---|---|
| มีจำนวนมาก | 500000 | 10.19 s | นา | 27000.0000 | 16000.0000 | 164.63 MB |
| มีจำนวนมาก | 10,00000 | 17.03 S | นา | 54000.0000 | 37000.0000 | 329.12 MB |
/src/entityframeworkcore.sqlserver.simplebulks.benchmarks/bulkdeletebenchmarks.cs
BenchmarkDotNet =v0.13.2, OS =Windows 10 (10.0.19045.5011)
11th Gen Intel Core i7-1165G7 2.80GHz, 1 CPU, 8 logical and 4 physical cores
.NET SDK =8.0.400
[Host] : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
Job-LGAVYD : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
InvocationCount =1 IterationCount =1 UnrollFactor =1
WarmupCount =0
| วิธี | Rowscount | หมายถึง | ข้อผิดพลาด | Gen0 | Gen1 | จัดสรร |
|---|---|---|---|---|---|---|
| efcoredelete | 100 | 73.25 ms | นา | - | - | 681.09 KB |
| จำนวนมาก | 100 | 29.42 ms | นา | - | - | 43.45 kb |
| efcoredelete | 1,000 | 176.83 ms | นา | 1,000.0000 | 1,000.0000 | 6745 KB |
| จำนวนมาก | 1,000 | 27.19 ms | นา | - | - | 236.86 KB |
| efcoredelete | 10,000 | 1,489.03 ms | นา | 10,000.0000 | 2000.0000 | 66031.55 KB |
| จำนวนมาก | 10,000 | 431.74 ms | นา | - | - | 2150.99 KB |
| efcoredelete | ปี 20000 | 6,084.87 ms | นา | 20000.0000 | 7000.0000 | 132403.3 KB |
| จำนวนมาก | ปี 20000 | 276.52 ms | นา | - | - | 4276.01 KB |
| efcoredelete | 50000 | 39,933.60 ms | นา | 49000.0000 | 14000.0000 | 326164.25 KB |
| จำนวนมาก | 50000 | 1,477.09 ms | นา | 1,000.0000 | - | 10594.63 KB |
BenchmarkDotNet =v0.13.2, OS =Windows 10 (10.0.19045.5011)
11th Gen Intel Core i7-1165G7 2.80GHz, 1 CPU, 8 logical and 4 physical cores
.NET SDK =8.0.400
[Host] : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
Job-LGAVYD : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
InvocationCount =1 IterationCount =1 UnrollFactor =1
WarmupCount =0
| วิธี | Rowscount | หมายถึง | ข้อผิดพลาด | Gen0 | Gen1 | จัดสรร |
|---|---|---|---|---|---|---|
| จำนวนมาก | 100000 | 937.7 ms | นา | 3000.0000 | 1,000.0000 | 20.67 MB |
| จำนวนมาก | 250000 | 2,619.7 มิลลิวินาที | นา | 7000.0000 | 3000.0000 | 51.7 MB |
| จำนวนมาก | 500000 | 4,897.7 ms | นา | 13000.0000 | 6000.0000 | 103.22 MB |
| จำนวนมาก | 10,00000 | 9,466.0 ms | นา | 26000.0000 | 12000.0000 | 206.28 MB |
/src/entityframeworkcore.sqlserver.simplebulks.benchmarks/bulkmergebenchmarks.cs
BenchmarkDotNet =v0.13.2, OS =Windows 10 (10.0.19045.5011)
11th Gen Intel Core i7-1165G7 2.80GHz, 1 CPU, 8 logical and 4 physical cores
.NET SDK =8.0.400
[Host] : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
Job-LGAVYD : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
InvocationCount =1 IterationCount =1 UnrollFactor =1
WarmupCount =0
| วิธี | Rowscount | หมายถึง | ข้อผิดพลาด | Gen0 | Gen1 | Gen2 | จัดสรร |
|---|---|---|---|---|---|---|---|
| efcoreupsert | 100 | 82.11 ms | นา | - | - | - | 1840.23 KB |
| จำนวนมาก | 100 | 34.27 ms | นา | - | - | - | 162.96 KB |
| efcoreupsert | 1,000 | 266.86 ms | นา | 2000.0000 | 1,000.0000 | - | 17984.91 KB |
| จำนวนมาก | 1,000 | 79.45 ms | นา | - | - | - | 1213.33 KB |
| efcoreupsert | 10,000 | 1,451.20 มิลลิวินาที | นา | 26000.0000 | 8000.0000 | - | 178385.15 KB |
| จำนวนมาก | 10,000 | 677.47 ms | นา | 1,000.0000 | - | - | 11679.42 KB |
| efcoreupsert | 100000 | 13,902.06 ms | นา | 266000.0000 | 63000.0000 | - | 1762696.52 KB |
| จำนวนมาก | 100000 | 3,415.31 มิลลิวินาที | นา | 16000.0000 | 6000.0000 | 1,000.0000 | 115233.2 KB |
| efcoreupsert | 250000 | 36,167.51 ms | นา | 665000.0000 | 152000.0000 | - | 4362872.57 KB |
| จำนวนมาก | 250000 | 7,681.71 ms | นา | 37000.0000 | 11000.0000 | 1,000.0000 | 284187.09 KB |
/src/entityframeworkcore.sqlserver.simplebulks.benchmarks/bulkmergereturndbgeneratedidbenchmarks.cs
BenchmarkDotNet =v0.13.2, OS =Windows 10 (10.0.19045.5011)
11th Gen Intel Core i7-1165G7 2.80GHz, 1 CPU, 8 logical and 4 physical cores
.NET SDK =8.0.400
[Host] : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
Job-LGAVYD : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
InvocationCount =1 IterationCount =1 UnrollFactor =1
WarmupCount =0
| วิธี | Rowscount | หมายถึง | ข้อผิดพลาด | Gen0 | Gen1 | Gen2 | จัดสรร |
|---|---|---|---|---|---|---|---|
| returndbgeneratedid | 100 | 38.45 มิลลิวินาที | นา | - | - | - | 151.09 KB |
| notreturndbgeneratedid | 100 | 37.75 ms | นา | - | - | - | 116.8 KB |
| returndbgeneratedid | 1,000 | 67.42 ms | นา | - | - | - | 1099.48 KB |
| notreturndbgeneratedid | 1,000 | 60.02 ms | นา | - | - | - | 769.23 KB |
| returndbgeneratedid | 10,000 | 783.73 ms | นา | 1,000.0000 | - | - | 10543.62 KB |
| notreturndbgeneratedid | 10,000 | 501.07 ms | นา | 1,000.0000 | - | - | 7348.79 KB |
| returndbgeneratedid | 100000 | 3,187.89 ms | นา | 14000.0000 | 5000.0000 | 1,000.0000 | 103878.09 KB |
| notreturndbgeneratedid | 100000 | 2,741.31 ms | นา | 11000.0000 | 5000.0000 | 1,000.0000 | 72936.01 KB |
BenchmarkDotNet =v0.13.2, OS =Windows 10 (10.0.19045.5011)
11th Gen Intel Core i7-1165G7 2.80GHz, 1 CPU, 8 logical and 4 physical cores
.NET SDK =8.0.400
[Host] : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
Job-LGAVYD : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
InvocationCount =1 IterationCount =1 UnrollFactor =1
WarmupCount =0
| วิธี | Rowscount | หมายถึง | ข้อผิดพลาด | Gen0 | Gen1 | Gen2 | จัดสรร |
|---|---|---|---|---|---|---|---|
| returndbgeneratedid | 250000 | 7.799 s | นา | 32000.0000 | 8000.0000 | - | 249.8 MB |
| notreturndbgeneratedid | 250000 | 6.619 S | นา | 24000.0000 | 7000.0000 | - | 177.7 MB |
| returndbgeneratedid | 500000 | 15.051 S | นา | 66000.0000 | 19000.0000 | 1,000.0000 | 500.64 MB |
| notreturndbgeneratedid | 500000 | 14.328 S | นา | 47000.0000 | 14000.0000 | - | 355.19 MB |
| returndbgeneratedid | 10,00000 | 32.449 S | นา | 129000.0000 | 34000.0000 | - | 1003.67 MB |
| notreturndbgeneratedid | 10,00000 | 28.253 S | นา | 95000.0000 | 28000.0000 | - | 710.22 MB |
คอลัมน์เดี่ยว /src/entityframeworkcore.sqlserver.simplebulks.benchmarks/bulkmatchsinglecolumnbenchmarks.cs
BenchmarkDotNet =v0.13.2, OS =Windows 10 (10.0.19045.5011)
11th Gen Intel Core i7-1165G7 2.80GHz, 1 CPU, 8 logical and 4 physical cores
.NET SDK =8.0.400
[Host] : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
Job-LGAVYD : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
InvocationCount =1 IterationCount =1 UnrollFactor =1
WarmupCount =0
| วิธี | Rowscount | หมายถึง | ข้อผิดพลาด | Gen0 | Gen1 | Gen2 | จัดสรร |
|---|---|---|---|---|---|---|---|
| efcoreselect | 100 | 97.373 ms | นา | - | - | - | 1008.33 KB |
| efcoreBatchSelect | 100 | 7.166 ms | นา | - | - | - | 94.77 KB |
| จำนวนมาก | 100 | 8.570 ms | นา | - | - | - | 106.63 kb |
| efcoreselect | 1,000 | 720.250 ms | นา | 1,000.0000 | - | - | 9761.42 KB |
| efcoreBatchSelect | 1,000 | 6.375 ms | นา | - | - | - | 908.18 KB |
| จำนวนมาก | 1,000 | 15.445 ms | นา | - | - | - | 820.36 KB |
| efcoreselect | 10,000 | 8,075.686 ms | นา | 15000.0000 | 1,000.0000 | - | 97115.62 KB |
| efcoreBatchSelect | 10,000 | 66.438 ms | นา | 1,000.0000 | - | - | 9092.91 KB |
| จำนวนมาก | 10,000 | 69.430 ms | นา | 1,000.0000 | - | - | 8177.76 KB |
| efcoreselect | 100000 | 81,088.718 ms | นา | 159000.0000 | 31000.0000 | 1,000.0000 | 972204.7 KB |
| efcoreBatchSelect | 100000 | 920.412 ms | นา | 11000.0000 | 4000.0000 | 1,000.0000 | 91808.56 KB |
| จำนวนมาก | 100000 | 742.030 ms | นา | 13000.0000 | 6000.0000 | 1,000.0000 | 82419.43 KB |
BenchmarkDotNet =v0.13.2, OS =Windows 10 (10.0.19045.5011)
11th Gen Intel Core i7-1165G7 2.80GHz, 1 CPU, 8 logical and 4 physical cores
.NET SDK =8.0.400
[Host] : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
Job-LGAVYD : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
InvocationCount =1 IterationCount =1 UnrollFactor =1
WarmupCount =0
| วิธี | Rowscount | หมายถึง | ข้อผิดพลาด | Gen0 | Gen1 | Gen2 | จัดสรร |
|---|---|---|---|---|---|---|---|
| efcoreBatchSelect | 250000 | 2.101 s | นา | 26000.0000 | 11000.0000 | 1,000.0000 | 224.05 MB |
| จำนวนมาก | 250000 | 2.067 s | นา | 32000.0000 | 12000.0000 | 1,000.0000 | 201.64 MB |
| efcoreBatchSelect | 500000 | 4.239 S | นา | 53000.0000 | 20000.0000 | 2000.0000 | 448.85 MB |
| จำนวนมาก | 500000 | 4.507 s | นา | 62000.0000 | 24000.0000 | 1,000.0000 | 404.03 MB |
| efcoreBatchSelect | 10,00000 | 8.523 s | นา | 103000.0000 | 38000.0000 | 1,000.0000 | 898.44 MB |
| จำนวนมาก | 10,00000 | 11.585 S | นา | 123000.0000 | 46000.0000 | 1,000.0000 | 808.82 MB |
หลายคอลัมน์ /src/entityframeworkcore.sqlserver.simplebulks.benchmarks/bulkmatchmultiplecolumnsbenchmarks.cs
BenchmarkDotNet =v0.13.2, OS =Windows 10 (10.0.19045.5011)
11th Gen Intel Core i7-1165G7 2.80GHz, 1 CPU, 8 logical and 4 physical cores
.NET SDK =8.0.400
[Host] : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
Job-LGAVYD : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
InvocationCount =1 IterationCount =1 UnrollFactor =1
WarmupCount =0
| วิธี | Rowscount | หมายถึง | ข้อผิดพลาด | Gen0 | Gen1 | จัดสรร |
|---|---|---|---|---|---|---|
| efcoreselect | 100 | 130.11 ms | นา | - | - | 1256.8 KB |
| จำนวนมาก | 100 | 15.46 ms | นา | - | - | 173.56 KB |
| efcoreselect | 1,000 | 997.87 ms | นา | 2000.0000 | - | 12373.85 KB |
| จำนวนมาก | 1,000 | 43.35 ms | นา | - | - | 1358.77 KB |
| efcoreselect | 10,000 | 9,769.96 มิลลิวินาที | นา | 20000.0000 | 4000.0000 | 123595.97 KB |
| จำนวนมาก | 10,000 | 238.80 ms | นา | 2000.0000 | 1,000.0000 | 13768.49 KB |
| efcoreselect | 100000 | 89,204.16 มิลลิวินาที | นา | 201000.0000 | 51000.0000 | 1237424.23 KB |
| จำนวนมาก | 100000 | 2,612.00 ms | นา | 21000.0000 | 8000.0000 | 138686.52 KB |
BenchmarkDotNet =v0.13.2, OS =Windows 10 (10.0.19045.5011)
11th Gen Intel Core i7-1165G7 2.80GHz, 1 CPU, 8 logical and 4 physical cores
.NET SDK =8.0.400
[Host] : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
Job-LGAVYD : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
InvocationCount =1 IterationCount =1 UnrollFactor =1
WarmupCount =0
| วิธี | Rowscount | หมายถึง | ข้อผิดพลาด | Gen0 | Gen1 | จัดสรร |
|---|---|---|---|---|---|---|
| จำนวนมาก | 250000 | 6.709 s | นา | 53000.0000 | 19000.0000 | 340.68 MB |
| จำนวนมาก | 500000 | 12.939 S | นา | 107000.0000 | 36000.0000 | 683.46 MB |
| จำนวนมาก | 10,00000 | 25.418 S | นา | 214000.0000 | 74000.0000 | 1369.34 MB |
/src/entityframeworkcore.sqlserver.simplebulks.benchmarks/temptablebenchmarks.cs
BenchmarkDotNet =v0.13.2, OS =Windows 10 (10.0.19045.5011)
11th Gen Intel Core i7-1165G7 2.80GHz, 1 CPU, 8 logical and 4 physical cores
.NET SDK =8.0.400
[Host] : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
Job-LGAVYD : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
InvocationCount =1 IterationCount =1 UnrollFactor =1
WarmupCount =0
| วิธี | Rowscount | หมายถึง | ข้อผิดพลาด | Gen0 | Gen1 | Gen2 | จัดสรร |
|---|---|---|---|---|---|---|---|
| สร้างสรรค์ได้ | 100 | 7.639 ms | นา | - | - | - | 68.03 KB |
| สร้างสรรค์ได้ | 1,000 | 14.077 ms | นา | - | - | - | 373.76 KB |
| สร้างสรรค์ได้ | 10,000 | 89.789 ms | นา | - | - | - | 3455.46 KB |
| สร้างสรรค์ได้ | 100000 | 574.937 ms | นา | 4000.0000 | 1,000.0000 | - | 34081.95 KB |
| สร้างสรรค์ได้ | 250000 | 1,403.071 ms | นา | 12000.0000 | 5000.0000 | 1,000.0000 | 85229.91 KB |
| สร้างสรรค์ได้ | 500000 | 2,838.562 ms | นา | 22000.0000 | 8000.0000 | 1,000.0000 | 170241.85 KB |
| สร้างสรรค์ได้ | 10,00000 | 6,198.206 ms | นา | 43000.0000 | 14000.0000 | 1,000.0000 | 340282.7 KB |
EntityFrameworkCore.sqlserver.simpleBulks ได้รับใบอนุญาตภายใต้ใบอนุญาต MIT