瀏覽代碼

Improve ASP.NET Ado performance 15-30% by removing CommandBehavior.SingleRow

This isn't necessary because we know that only one row will be returned
and it causes the MySql provider to send two extra commands per query.
This didn't seem to change the PostgreSQL performance.

The ado/mysql test improved about 15% and the ado/mysql/update test
improved about 30%.
Malcolm Evershed 12 年之前
父節點
當前提交
b8f3e7e17b
共有 1 個文件被更改,包括 6 次插入2 次删除
  1. 6 2
      aspnet/src/Controllers/AdoController.cs

+ 6 - 2
aspnet/src/Controllers/AdoController.cs

@@ -45,7 +45,9 @@ namespace Benchmarks.AspNet.Controllers
                         command.Parameters.Clear();
                         command.Parameters.Clear();
                         command.Parameters.Add(parameter);
                         command.Parameters.Add(parameter);
                         
                         
-                        using (DbDataReader reader = command.ExecuteReader(CommandBehavior.SingleRow))
+                        // Don't use CommandBehavior.SingleRow because that will make the MySql provider
+                        // send two extra commands to limit the result to one row.
+                        using (DbDataReader reader = command.ExecuteReader())
                         {
                         {
                             if (reader.Read())
                             if (reader.Read())
                             {
                             {
@@ -124,7 +126,9 @@ namespace Benchmarks.AspNet.Controllers
 
 
                         World world = null;
                         World world = null;
 
 
-                        using (DbDataReader reader = selectCommand.ExecuteReader(CommandBehavior.SingleRow))
+                        // Don't use CommandBehavior.SingleRow because that will make the MySql provider
+                        // send two extra commands to limit the result to one row.
+                        using (DbDataReader reader = selectCommand.ExecuteReader())
                         {
                         {
                             if (reader.Read())
                             if (reader.Read())
                             {
                             {