mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-18 20:08:15 +08:00
ExpreessTree替代反射缓存(1)
This commit is contained in:
@ -20,7 +20,7 @@ namespace FreeSql.Tests.PerformanceTest {
|
||||
time.Restart();
|
||||
List<xxx> dplist1 = null;
|
||||
using (var conn = g.mysql.Ado.MasterPool.Get()) {
|
||||
dplist1 = Dapper.SqlMapper.Query<xxx>(conn.Value, "select * from song limit 1").ToList();
|
||||
dplist1 = Dapper.SqlMapper.Query<xxx>(conn.Value, "select * from song").ToList();
|
||||
}
|
||||
time.Stop();
|
||||
sb.AppendLine($"Elapsed: {time.Elapsed}; Query Entity Counts: {dplist1.Count}; ORM: Dapper");
|
||||
@ -44,6 +44,8 @@ namespace FreeSql.Tests.PerformanceTest {
|
||||
|
||||
|
||||
|
||||
var t31 = g.mysql.Ado.Query<xxx>("select * from song limit 1");
|
||||
|
||||
time.Restart();
|
||||
var t3 = g.mysql.Ado.Query<xxx>("select * from song");
|
||||
time.Stop();
|
||||
@ -130,6 +132,13 @@ namespace FreeSql.Tests.PerformanceTest {
|
||||
var sb = new StringBuilder();
|
||||
var time = new Stopwatch();
|
||||
|
||||
//var t31 = g.mysql.Select<xxx>().ToList();
|
||||
|
||||
time.Restart();
|
||||
var t3 = g.mysql.Select<xxx>().ToList();
|
||||
time.Stop();
|
||||
sb.AppendLine($"Elapsed: {time.Elapsed}; ToList Entity Counts: {t3.Count}; ORM: FreeSql*");
|
||||
|
||||
time.Restart();
|
||||
List<xxx> dplist1 = null;
|
||||
using (var conn = g.mysql.Ado.MasterPool.Get()) {
|
||||
@ -137,12 +146,6 @@ namespace FreeSql.Tests.PerformanceTest {
|
||||
}
|
||||
time.Stop();
|
||||
sb.AppendLine($"Elapsed: {time.Elapsed}; Query Entity Counts: {dplist1.Count}; ORM: Dapper");
|
||||
|
||||
|
||||
time.Restart();
|
||||
var t3 = g.mysql.Select<xxx>().ToList();
|
||||
time.Stop();
|
||||
sb.AppendLine($"Elapsed: {time.Elapsed}; ToList Entity Counts: {t3.Count}; ORM: FreeSql*");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -150,6 +153,19 @@ namespace FreeSql.Tests.PerformanceTest {
|
||||
var sb = new StringBuilder();
|
||||
var time = new Stopwatch();
|
||||
|
||||
time.Restart();
|
||||
var t3Count = 0;
|
||||
var p3 = Parallel.For(1, 50, b => {
|
||||
List<xxx> t3 = new List<xxx>();
|
||||
for (var a = 0; a < 1000; a++) {
|
||||
t3.AddRange(g.mysql.Select<xxx>().Limit(50).ToList());
|
||||
}
|
||||
Interlocked.Add(ref t3Count, t3.Count);
|
||||
});
|
||||
while (p3.IsCompleted == false) ;
|
||||
time.Stop();
|
||||
sb.AppendLine($"Elapsed: {time.Elapsed}; ToList Entity Counts: {t3Count}; ORM: FreeSql*");
|
||||
|
||||
time.Restart();
|
||||
var dplist1Count = 0;
|
||||
var p1 = Parallel.For(1, 50, b => {
|
||||
@ -159,25 +175,11 @@ namespace FreeSql.Tests.PerformanceTest {
|
||||
dplist1.AddRange(Dapper.SqlMapper.Query<xxx>(conn.Value, "select * from song limit 50").ToList());
|
||||
}
|
||||
}
|
||||
Interlocked.Exchange(ref dplist1Count, dplist1.Count);
|
||||
Interlocked.Add(ref dplist1Count, dplist1.Count);
|
||||
});
|
||||
while (p1.IsCompleted == false) ;
|
||||
time.Stop();
|
||||
sb.AppendLine($"Elapsed: {time.Elapsed}; Query Entity Counts: {dplist1Count}; ORM: Dapper");
|
||||
|
||||
|
||||
time.Restart();
|
||||
var t3Count = 0;
|
||||
var p3 = Parallel.For(1, 50, b => {
|
||||
List<xxx> t3 = new List<xxx>();
|
||||
for (var a = 0; a < 1000; a++) {
|
||||
t3.AddRange(g.mysql.Select<xxx>().Limit(50).ToList());
|
||||
}
|
||||
Interlocked.Exchange(ref t3Count, t3.Count);
|
||||
});
|
||||
while (p3.IsCompleted == false) ;
|
||||
time.Stop();
|
||||
sb.AppendLine($"Elapsed: {time.Elapsed}; ToList Entity Counts: {t3Count}; ORM: FreeSql*");
|
||||
}
|
||||
|
||||
[Table(Name = "song")]
|
||||
|
Reference in New Issue
Block a user