Uma biblioteca principal .NET muito simples que pode ajudar a sincronizar um grande número de registros na memória no banco de dados usando a classe sqlbulkcopy .
Esta biblioteca fornece métodos de extensão para que você possa usar com o seu entityframeworkcore dbContext Instância dbContexTextensions.cs ou você pode usar o sqlConnectionExtensions.cs para trabalhar diretamente com uma instância do SQLConnection sem usar o 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)" ) ; Tabela única /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
| Método | Lotes | Significar | Erro | Gen0 | Gen1 | Gen2 | Alocado |
|---|---|---|---|---|---|---|---|
| EfcoreInsert | 100 | 45.19 MS | N / D | - | - | - | 985,52 KB |
| Bulkinsert | 100 | 32.68 MS | N / D | - | - | - | 93,78 KB |
| EfcoreInsert | 1000 | 145.41 MS | N / D | 1000.0000 | - | - | 9702.7 KB |
| Bulkinsert | 1000 | 44,94 MS | N / D | - | - | - | 573,84 KB |
| EfcoreInsert | 10000 | 788,90 ms | N / D | 14000.0000 | 5000.0000 | - | 95727.38 KB |
| Bulkinsert | 10000 | 126,36 MS | N / D | - | - | - | 5320,53 KB |
| EfcoreInsert | 100000 | 7.107,29 ms | N / D | 146000.0000 | 36000.0000 | - | 950162.56 KB |
| Bulkinsert | 100000 | 998,42 MS | N / D | 7000.0000 | 3000.0000 | 1000.0000 | 51730.81 KB |
| EfcoreInsert | 250000 | 18.542,56 ms | N / D | 365000.0000 | 87000.0000 | - | 2352262.34 KB |
| Bulkinsert | 250000 | 2.576,88 ms | N / D | 16000.0000 | 5000.0000 | 1000.0000 | 125832.63 KB |
| EfcoreInsert | 500000 | 34.957,34 ms | N / D | 730000.0000 | 170000.0000 | - | 4711772.88 KB |
| Bulkinsert | 500000 | 5.553,61 ms | N / D | 30000.0000 | 9000.0000 | 1000.0000 | 252707.77 KB |
Várias tabelas (1x linhas parentais + 5x linhas infantis) /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
| Método | Lotes | Significar | Erro | Gen0 | Gen1 | Gen2 | Alocado |
|---|---|---|---|---|---|---|---|
| EfcoreInsert | 100 | 226.22 MS | N / D | 1000.0000 | - | - | 7438.51 KB |
| Bulkinsert | 100 | 48,38 MS | N / D | - | - | - | 444.18 KB |
| EfcoreInsert | 1000 | 566,95 ms | N / D | 11000.0000 | 4000.0000 | - | 73518.48 KB |
| Bulkinsert | 1000 | 125,77 MS | N / D | - | - | - | 3460.21 KB |
| EfcoreInsert | 10000 | 6.268,42 ms | N / D | 114000.0000 | 30000.0000 | - | 731076.92 KB |
| Bulkinsert | 10000 | 1.066,74 ms | N / D | 5000.0000 | 2000.0000 | 1000.0000 | 33324.16 KB |
| EfcoreInsert | 100000 | 59.389,89 MS | N / D | 1138000.0000 | 264000.0000 | - | 7282561.93 KB |
| Bulkinsert | 100000 | 9.504,12 ms | N / D | 39000.0000 | 13000.0000 | 1000.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
| Método | Lotes | Significar | Erro | Gen0 | Gen1 | Alocado |
|---|---|---|---|---|---|---|
| EfcoreUpdate | 100 | 61,65 ms | N / D | - | - | 853,66 KB |
| Bulkupdate | 100 | 27.33 MS | N / D | - | - | 63,55 kb |
| EfcoreUpdate | 1000 | 143.39 MS | N / D | 1000.0000 | - | 8398.1 KB |
| Bulkupdate | 1000 | 43,95 ms | N / D | - | - | 379,25 KB |
| EfcoreUpdate | 10000 | 685,97 MS | N / D | 12000.0000 | 3000.0000 | 82396.19 KB |
| Bulkupdate | 10000 | 182,54 MS | N / D | - | - | 3499.74 KB |
| EfcoreUpdate | 100000 | 8.495,18 ms | N / D | 120000.0000 | 28000.0000 | 810248.07 KB |
| Bulkupdate | 100000 | 2.091,42 ms | N / D | 5000.0000 | 1000.0000 | 33819.46 KB |
| EfcoreUpdate | 250000 | 17.859,49 MS | N / D | 300000.0000 | 69000.0000 | 2005895.77 KB |
| Bulkupdate | 250000 | 4.290,07 ms | N / D | 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
| Método | Lotes | Significar | Erro | Gen0 | Gen1 | Alocado |
|---|---|---|---|---|---|---|
| Bulkupdate | 500000 | 10.19 s | N / D | 27000.0000 | 16000.0000 | 164,63 MB |
| Bulkupdate | 1000000 | 17.03 s | N / D | 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
| Método | Lotes | Significar | Erro | Gen0 | Gen1 | Alocado |
|---|---|---|---|---|---|---|
| Efcoredelete | 100 | 73,25 ms | N / D | - | - | 681.09 KB |
| Bulkdelete | 100 | 29.42 MS | N / D | - | - | 43.45 KB |
| Efcoredelete | 1000 | 176,83 MS | N / D | 1000.0000 | 1000.0000 | 6745 KB |
| Bulkdelete | 1000 | 27.19 MS | N / D | - | - | 236,86 KB |
| Efcoredelete | 10000 | 1.489,03 ms | N / D | 10000.0000 | 2000.0000 | 66031.55 KB |
| Bulkdelete | 10000 | 431,74 MS | N / D | - | - | 2150.99 KB |
| Efcoredelete | 20000 | 6.084,87 ms | N / D | 20000.0000 | 7000.0000 | 132403.3 KB |
| Bulkdelete | 20000 | 276.52 MS | N / D | - | - | 4276.01 KB |
| Efcoredelete | 50000 | 39.933,60 ms | N / D | 49000.0000 | 14000.0000 | 326164.25 KB |
| Bulkdelete | 50000 | 1.477,09 ms | N / D | 1000.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
| Método | Lotes | Significar | Erro | Gen0 | Gen1 | Alocado |
|---|---|---|---|---|---|---|
| Bulkdelete | 100000 | 937,7 MS | N / D | 3000.0000 | 1000.0000 | 20,67 MB |
| Bulkdelete | 250000 | 2.619,7 ms | N / D | 7000.0000 | 3000.0000 | 51,7 MB |
| Bulkdelete | 500000 | 4.897,7 ms | N / D | 13000.0000 | 6000.0000 | 103,22 MB |
| Bulkdelete | 1000000 | 9.466,0 ms | N / D | 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
| Método | Lotes | Significar | Erro | Gen0 | Gen1 | Gen2 | Alocado |
|---|---|---|---|---|---|---|---|
| EfcoreupSert | 100 | 82.11 ms | N / D | - | - | - | 1840.23 KB |
| Bulkmerge | 100 | 34,27 MS | N / D | - | - | - | 162,96 KB |
| EfcoreupSert | 1000 | 266.86 MS | N / D | 2000.0000 | 1000.0000 | - | 17984.91 KB |
| Bulkmerge | 1000 | 79,45 MS | N / D | - | - | - | 1213.33 KB |
| EfcoreupSert | 10000 | 1.451,20 ms | N / D | 26000.0000 | 8000.0000 | - | 178385.15 KB |
| Bulkmerge | 10000 | 677,47 MS | N / D | 1000.0000 | - | - | 11679.42 KB |
| EfcoreupSert | 100000 | 13.902,06 ms | N / D | 266000.0000 | 63000.0000 | - | 1762696.52 KB |
| Bulkmerge | 100000 | 3.415,31 ms | N / D | 16000.0000 | 6000.0000 | 1000.0000 | 115233.2 KB |
| EfcoreupSert | 250000 | 36.167,51 ms | N / D | 665000.0000 | 152000.0000 | - | 4362872.57 KB |
| Bulkmerge | 250000 | 7.681,71 ms | N / D | 37000.0000 | 11000.0000 | 1000.0000 | 284187.09 KB |
/src/entityframeworkcore.sqlserver.simplebulks.benchmarks/bulkmergereturnndbgeneratedIdbenchmarks.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
| Método | Lotes | Significar | Erro | Gen0 | Gen1 | Gen2 | Alocado |
|---|---|---|---|---|---|---|---|
| ReturndbgeneratedId | 100 | 38,45 ms | N / D | - | - | - | 151.09 KB |
| NotreturnDBGeneratedId | 100 | 37,75 ms | N / D | - | - | - | 116,8 kb |
| ReturndbgeneratedId | 1000 | 67,42 MS | N / D | - | - | - | 1099.48 KB |
| NotreturnDBGeneratedId | 1000 | 60,02 ms | N / D | - | - | - | 769.23 KB |
| ReturndbgeneratedId | 10000 | 783,73 MS | N / D | 1000.0000 | - | - | 10543.62 KB |
| NotreturnDBGeneratedId | 10000 | 501,07 ms | N / D | 1000.0000 | - | - | 7348.79 KB |
| ReturndbgeneratedId | 100000 | 3.187,89 ms | N / D | 14000.0000 | 5000.0000 | 1000.0000 | 103878.09 KB |
| NotreturnDBGeneratedId | 100000 | 2.741,31 ms | N / D | 11000.0000 | 5000.0000 | 1000.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
| Método | Lotes | Significar | Erro | Gen0 | Gen1 | Gen2 | Alocado |
|---|---|---|---|---|---|---|---|
| ReturndbgeneratedId | 250000 | 7.799 s | N / D | 32000.0000 | 8000.0000 | - | 249,8 MB |
| NotreturnDBGeneratedId | 250000 | 6.619 s | N / D | 24000.0000 | 7000.0000 | - | 177,7 MB |
| ReturndbgeneratedId | 500000 | 15.051 s | N / D | 66000.0000 | 19000.0000 | 1000.0000 | 500,64 MB |
| NotreturnDBGeneratedId | 500000 | 14.328 s | N / D | 47000.0000 | 14000.0000 | - | 355.19 MB |
| ReturndbgeneratedId | 1000000 | 32.449 s | N / D | 129000.0000 | 34000.0000 | - | 1003,67 MB |
| NotreturnDBGeneratedId | 1000000 | 28.253 s | N / D | 95000.0000 | 28000.0000 | - | 710.22 MB |
Coluna única /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
| Método | Lotes | Significar | Erro | Gen0 | Gen1 | Gen2 | Alocado |
|---|---|---|---|---|---|---|---|
| EfcoreSelect | 100 | 97.373 MS | N / D | - | - | - | 1008,33 KB |
| EfcoreBatchSelect | 100 | 7.166 ms | N / D | - | - | - | 94,77 KB |
| BulkMatch | 100 | 8.570 ms | N / D | - | - | - | 106,63 KB |
| EfcoreSelect | 1000 | 720.250 ms | N / D | 1000.0000 | - | - | 9761.42 KB |
| EfcoreBatchSelect | 1000 | 6.375 ms | N / D | - | - | - | 908.18 KB |
| BulkMatch | 1000 | 15.445 ms | N / D | - | - | - | 820,36 KB |
| EfcoreSelect | 10000 | 8.075.686 ms | N / D | 15000.0000 | 1000.0000 | - | 97115.62 KB |
| EfcoreBatchSelect | 10000 | 66.438 MS | N / D | 1000.0000 | - | - | 9092.91 KB |
| BulkMatch | 10000 | 69.430 MS | N / D | 1000.0000 | - | - | 8177,76 KB |
| EfcoreSelect | 100000 | 81.088.718 ms | N / D | 159000.0000 | 31000.0000 | 1000.0000 | 972204.7 KB |
| EfcoreBatchSelect | 100000 | 920.412 MS | N / D | 11000.0000 | 4000.0000 | 1000.0000 | 91808.56 KB |
| BulkMatch | 100000 | 742.030 MS | N / D | 13000.0000 | 6000.0000 | 1000.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
| Método | Lotes | Significar | Erro | Gen0 | Gen1 | Gen2 | Alocado |
|---|---|---|---|---|---|---|---|
| EfcoreBatchSelect | 250000 | 2.101 s | N / D | 26000.0000 | 11000.0000 | 1000.0000 | 224,05 MB |
| BulkMatch | 250000 | 2.067 s | N / D | 32000.0000 | 12000.0000 | 1000.0000 | 201.64 MB |
| EfcoreBatchSelect | 500000 | 4.239 s | N / D | 53000.0000 | 20000.0000 | 2000.0000 | 448,85 MB |
| BulkMatch | 500000 | 4.507 s | N / D | 62000.0000 | 24000.0000 | 1000.0000 | 404.03 MB |
| EfcoreBatchSelect | 1000000 | 8.523 s | N / D | 103000.0000 | 38000.0000 | 1000.0000 | 898,44 MB |
| BulkMatch | 1000000 | 11.585 s | N / D | 123000.0000 | 46000.0000 | 1000.0000 | 808,82 MB |
Várias colunas /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
| Método | Lotes | Significar | Erro | Gen0 | Gen1 | Alocado |
|---|---|---|---|---|---|---|
| EfcoreSelect | 100 | 130.11 ms | N / D | - | - | 1256,8 KB |
| BulkMatch | 100 | 15,46 ms | N / D | - | - | 173,56 KB |
| EfcoreSelect | 1000 | 997,87 MS | N / D | 2000.0000 | - | 12373.85 KB |
| BulkMatch | 1000 | 43,35 ms | N / D | - | - | 1358.77 KB |
| EfcoreSelect | 10000 | 9.769,96 ms | N / D | 20000.0000 | 4000.0000 | 123595.97 KB |
| BulkMatch | 10000 | 238,80 ms | N / D | 2000.0000 | 1000.0000 | 13768.49 KB |
| EfcoreSelect | 100000 | 89.204,16 ms | N / D | 201000.0000 | 51000.0000 | 1237424.23 KB |
| BulkMatch | 100000 | 2.612,00 ms | N / D | 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
| Método | Lotes | Significar | Erro | Gen0 | Gen1 | Alocado |
|---|---|---|---|---|---|---|
| BulkMatch | 250000 | 6.709 s | N / D | 53000.0000 | 19000.0000 | 340,68 MB |
| BulkMatch | 500000 | 12.939 s | N / D | 107000.0000 | 36000.0000 | 683,46 MB |
| BulkMatch | 1000000 | 25.418 s | N / D | 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
| Método | Lotes | Significar | Erro | Gen0 | Gen1 | Gen2 | Alocado |
|---|---|---|---|---|---|---|---|
| CreateTeptable | 100 | 7.639 ms | N / D | - | - | - | 68,03 KB |
| CreateTeptable | 1000 | 14.077 MS | N / D | - | - | - | 373.76 KB |
| CreateTeptable | 10000 | 89.789 MS | N / D | - | - | - | 3455.46 KB |
| CreateTeptable | 100000 | 574.937 MS | N / D | 4000.0000 | 1000.0000 | - | 34081.95 KB |
| CreateTeptable | 250000 | 1.403.071 ms | N / D | 12000.0000 | 5000.0000 | 1000.0000 | 85229.91 KB |
| CreateTeptable | 500000 | 2.838.562 ms | N / D | 22000.0000 | 8000.0000 | 1000.0000 | 170241.85 KB |
| CreateTeptable | 1000000 | 6.198.206 MS | N / D | 43000.0000 | 14000.0000 | 1000.0000 | 340282.7 KB |
Entityframeworkcore.sqlserver.simplebulks é licenciado sob a licença do MIT.