Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Summary and efficiency Test of mainstream Framework of ORM for Net

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

The framework has been paid attention to and used by more and more people. Today we will take a look at several mainstream ORM frameworks in net and their efficiency tests (there may be some omissions. Welcome to discuss).

ORM framework: an acronym for Object/Relation Mapping (object / relational mapping), an easy-to-understand way to model data. To put it simply, it is to convert the relational data type of the database to the frame type controlled by the object program.

The orm framework studied today is as follows:

1.NHibernate (use and introduction: http://www.cnblogs.com/stone_w/archive/2011/09/15/2177830.html)

2.iBatis (use and introduction: http://www.cnblogs.com/stone_w/archive/2011/09/26/2192155.html)

3.NBear (use and introduction: http://www.cnblogs.com/stone_w/archive/2011/09/21/2184376.html)

4.SubSonic (use and introduction: http://www.cnblogs.com/stone_w/archive/2011/09/22/2185152.html)

5.GentleNet (use and introduction: http://www.cnblogs.com/stone_w/archive/2011/09/16/2179157.html)

Table of contents:

1) introduction of efficiency test environment.

2) A brief introduction to the testing framework.

3) comparison of test CRUD results table.

4) Test CRUD ranking.

5) Analysis of the advantages and disadvantages of the framework.

Text:

1) introduction of efficiency test environment.

Adopt netframework 4.0Web website project, use Stopwatch to calculate the execution time, and use Parallel object to realize concurrent operation. In order to test close to the actual type, I turned off all the programs on the computer and repeated the average of 100000 pieces of data in the same environment 10 times except the test program.

Test database T-Sql:

Test databases and tables

2) A brief introduction to the testing framework.

Stopwatch watch = new Stopwatch ()

Watch.Start ()

Parallel.For (0, 100000, I = >

{

/ /... Business

});

Watch.Stop ()

Response.Write (watch.ElapsedMilliseconds)

3) comparison of test CRUD results table.

Add a functional test table:

Operation

Add

Amount of data (ten thousand items)

10w

Number of tests

10 times.

Frame name

GentleNet

NBear

IBate

SubSonic

NHibernate

Concurrent execution time (ms)

36731

113793

36321

56342

Unmeasured

Non-concurrent execution time (ms)

115875

223768

100719

124844

1247572

Modify the functional test table:

Operation

Modify

Amount of data (ten thousand items)

10w

Number of tests

10 times.

Frame name

GentleNet

NBear

IBate

SubSonic

NHibernate

Concurrent execution time (ms)

25985

140779

33366

36916

Unmeasured

Non-concurrent execution time (ms)

98868

279851

102875

102821

1226506

Query the functional test table:

Operation

Query

Amount of data (ten thousand items)

10w

Number of tests

10 times.

Frame name

GentleNet

NBear

IBate

SubSonic

NHibernate

Concurrent execution time (ms)

19776

94265

39854

26784

Unmeasured

Non-concurrent execution time (ms)

54515

157676

37339

67344

1438398

Delete the functional test table:

Operation

Delete

Amount of data (ten thousand items)

10w

Number of tests

10 times.

Frame name

GentleNet

NBear

IBate

SubSonic

NHibernate

Concurrent execution time (ms)

33802

101516

31964

28223

Unmeasured

Non-concurrent execution time (ms)

102107

211105

88420

97846

1230465

4), CRUD test ranking.

The following is a ranking of 100000 data queries in milliseconds (ms).

=

Increase the ranking:

Top1:iBate concurrency: 36321ms non-concurrency: 100719ms

Top2:GentleNet concurrency: 36731ms non-concurrency: 115875ms

Top3:SubSonic concurrency: 56342ms non-concurrency: 124844

Ms

Top4:NBear concurrency: 113793ms non-concurrency: 223768

Ms

Top5:NHibernate non-concurrency: 1247572

Ms

=

Modify the ranking:

Top1:GentleNet concurrency: 25985ms non-concurrency: 98868ms

Top2:iBate concurrency: 33366ms non-concurrency: 102875

Ms

Top3:SubSonic concurrency: 36916ms non-concurrency: 124844

Ms

Top4:NBear concurrency: 113793ms non-concurrency: 102821

Ms

Top5:NHibernate non-concurrency: 279851

Ms

=

Query ranking:

Top1:GentleNet concurrency: 19776ms non-concurrency: 54515ms

Top2:SubSonic concurrency: 26784ms non-concurrency: 67344ms

Top3:iBate concurrency: 39854ms non-concurrency: 37339 (query efficiency is highest under non-concurrency) ms

Top4:NBear concurrency: 94265ms non-concurrency: 157676ms

Top5:NHibernate non-concurrency: 1438398

Ms

=

Delete ranking:

Top1:SubSonic concurrency: 28223ms non-concurrency: 97846ms

Top2:iBate concurrency: 31964ms non-concurrency: 88420ms

Top3:GentleNet concurrency: 33802ms non-concurrency: 102107ms

Top4:NBear concurrency: 101516ms non-concurrency: 211105ms

Top5:NHibernate non-concurrency: 1230465ms

=

5) Analysis of the advantages and disadvantages of the framework.

Gentle.Net

Advantages: support t-sql, simple and convenient syntax, high efficiency.

Cons: rely on the code generator to generate each entity class.

IBatis

Advantages: the efficiency is relatively high, especially in the case of non-concurrency, the effect is high and stable.

Disadvantages: there are many configuration files, t-sql is written in each configuration file, and the condition query is more troublesome.

SubSonic

Advantages: delete and query effect is very good, add relatively slow.

Disadvantages: grammar is relatively close to Linq, grammar into its own school is more dissatisfied.

NHibernate

Advantages: full coverage, good stability, good integration performance, widely used, support t-sql and hql syntax.

Disadvantages: more configuration, more troublesome, slow efficiency.

NBear

Advantages: the configuration is the easiest.

Disadvantages: the operation syntax is not mature, does not support t-sql, is not easy to use, and has not been updated for a long time.

Ps: you choose the right framework based on the test results.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report