Performance evaluation data frame CYQ.Data

Recently, users often focus CYQ.Data  performance problems, although concern, but did not take the initiative to find out who wrote the framework of performance evaluation and other articles.

 

Some individuals usually busy, since so long, have not been good for the CYQ.Data  write a simple performance testing.

 

Today, as it was wrote up.

 

10,11 a few words:

When a lot of people ask me CYQ.Data time how performance, I said: better than the performance of other ORM framework of.

 

Of course, I did not give any test data to prove, because I have not used other frameworks, so I can not give data, so users can either: Believe it or love.

 

He said framework is better than the other, of course, not because of praises like melon sweet, but based on the following recognition:

Data frame, normally by several processes: the external representation package -> generating SQL-> ADO.NET call execution.

 

Wherein a kind of a substantially ADO.NET performed, therefore, the performance difference is also reflected in the frame form the outer package and generates SQL procedure, most of the difference in performance depending on the complexity of the package.

 

And CYQ.Data  , are used in a multi-pack SQLHelper layer, taking the index native form, so the speed of the package and generates SQL, is other than NHibernate, Spring.Net, Entity Framework, Linq like the faster of.

 

Therefore, I will briefly come to a simple conclusion, but not rigorous.

 

Description:

Since no other customary framework, so the evaluation here, do not compare with other frameworks.

And will use the native ADO the .NET comparison test CYQ.Data how much performance difference with the original framework.

Framework to understand other people, and native ADO.NET a ratio, naturally, can be drawn and CYQ.Data performance difference of the.

 

The only test writing test data, test code will be displayed later.

 

A: write cycle call inserting data to see the results first

 

1: Data Insert 10:

2: Insert 100 Data:

3: Insert 1000 Data:

 

Analysis of data from the top in FIG. 3, the temporary concluded that:

In the case of a small amount of data, CYQ.Data performance is also superior to even the native ADO.NET.

As the amount of data to rise, CYQ.Data performance began to decline.

 

Conclusion questions:

This conclusion people looked very confused, even unlikely, there are few doubts:

1: CYQ.Data ADO.NET data framework is based on the package, how could perform faster than ADO.NET?

2: CYQ.Data when the number of cycles increases, performance is getting down?

3: CYQ.Data of MAction poor performance so far of more than MProc?

 

FAQ, found the problem:

1: CYQ.Data default transaction mechanism turned on, resulting in a high number of free transactions ADO.NET call performance than examples.

2: inside CYQ.Data DebugInfo properties, since the cycle to continue executing SQL statements to add records induced degradation.

Usually people often is the difference between the test string and the StringBuilder.

3: MAction an inner multi-backfilling, i.e. after the insertion, according to the ID query data filled downlink data, so it is not fair test.

 

II: fair test

 

CYQ.Data : close debugging information, close the transaction, MAction close backfilled.

 

Meanwhile, in order to avoid the performance impact caused due to the execution of the order, I have each performed separately, after the execution of the truncate table and then execute another.

 

In the absence of execution together, you can not see the screenshot with information output, only a single copy down the results.

 

The results are as follows:

1: Data Insert 10:

ADO.net [ADO.net]: 0.15625 [sec] --10
CYQ.Data [MProc ##]: 0.171875 [s] --10
CYQ.Data [MAction]: .265625 [sec] --10

2: Insert 100 Data:

ADO.net [ADO.net]: 0.203125 [s] --100
CYQ.Data [MProc ##]: 0.234375 [s] --100
CYQ.Data [MAction]: 0.3125 [sec] --100

3: Insert 1000 Data:

ADO.net [ADO.net]: 0.53125 [sec] --1000
CYQ.Data [MProc ##]: .859375 [sec] --1000
CYQ.Data [MAction]: 1.015625 [s] --1000

 

From the above analysis of three sets of data, we see:

CYQ.Data performance and substantially maintained ADO.NET almost the same, when the data amount rises to 1000, it is only less than two times the gap.


Thus described, CYQ.Data in performance, the ADO.NET is quite close to the original, the reason is that it is not too much to be packaged ADO.NET.


Just a simple package, but it is so easy to use, this is how it differs from other frameworks where the greatest advantage.

 

Of course, this is only a small test, do not represent the overall rigorous answer.

 

But, in some ways, it can be considered to the users in question this performance framework, made little answer.

 

At least, it is worth you have.

 

Download : http://www.cyqdata.com/download/article-detail-426

 

III: Test Code Example:

 

1: The original ADO the .NET test code:

        public static void ADO_NET()
        {
            DateTime start = DateTime.Now;
            SqlConnection con = new SqlConnection("server=.;database=abc;uid=sa;pwd=123456");
            SqlCommand com = new SqlCommand();
            com.Connection = con;
            com.CommandText = "insert into Users(UserName,Password) values( @UserName ,@Password)";
            con.Open();
            for (int i = 0; i < count; i++)
            {
                com.Parameters.Clear();
                com.Parameters.AddWithValue("@UserName", "U_" + System.Threading.Thread.CurrentThread.ManagedThreadId);
                com.Parameters.AddWithValue("@Password", "P_" + i);
                if (com.ExecuteNonQuery() > -1)
                {
                    ok2++;
                }
            }
            con.Close();
            TimeSpan ts = DateTime.Now - start;
            Console.WriteLine("ADO.net [ADO.net]:" + ts.TotalSeconds + "[秒]--" + ok2);
        }

 

2: CYQ.Data of MProc test code:

 public static void MProc()
        {
            DateTime start = DateTime.Now;
            MProc proc = new MProc("insert into Users(UserName,Password) values(@UserName ,@Password)");
            proc.EndTransation();//关闭事务
            for (int i = 0; i < count; i++)
            {
                proc.Clear();
                proc.Set("@UserName", "U_" + System.Threading.Thread.CurrentThread.ManagedThreadId);
                proc.Set("@Password", "P_" + i);
                if (proc.ExeNonQuery() > -1)
                {
                    ok3++;
                }
            }
            proc.Close();
            TimeSpan ts = DateTime.Now - start;
            Console.WriteLine("CYQ.Data[MProc##]:" + ts.TotalSeconds + "[秒]--" + ok3);
        }

 

3: CYQ.Data of MAction test code:

         public static void MAction()
        {
            DateTime start = DateTime.Now;
            MAction action = new MAction("Users");
            action.EndTransation();//关闭事务
            for (int i = 0; i < count; i++)
            {
                action.Set("UserName", "U_" + System.Threading.Thread.CurrentThread.ManagedThreadId);
                action.Set("Password", "P_" + i);
                if (action.Insert())
                {
                    ok++;
                }
            }
            action.Close();
            TimeSpan ts = DateTime.Now - start;
            Console.WriteLine("CYQ.Data[MAction]:" + ts.TotalSeconds + "[秒]--" + ok);
        }

Reproduced in: https: //my.oschina.net/secyaher/blog/274059

Guess you like

Origin blog.csdn.net/weixin_34365417/article/details/91966951