|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Announcements
Chapters
Services
Feature Zones
|
Note: This is an unedited contribution. If this article is inappropriate,
needs attention or copies someone else's work without reference then please
Report This Article
IntroductionMost you like me have been watching the release of VS 2008 from its beta versions. From the perspective of this article Microsoft added generics, query operators and LinQ support. I was always wandering why LinQ was added when the world has been comfortable with · Performance of reading data from SQL Server 2005 using ADO.net and LinQ using a Stored procedure · Performance of reading data from SQL Server 2005 using ADO.net and LinQ by directly executing SQL statements. · Performance of reading and manipulating xml files using existing c# approaches vs. LinQ approach · Performance of accessing list of objects ( arrays in this article ) using traditional programming , LinQ and C# 3.0 · Performance of filling a dataset using ADO and LinQ and then performing a filer operation and then summing up something after filtering. Before we jump into this article , I want to point out that there are many ways to accomplish a task programmatically, An effort has been made to write the best code possible , there are extra lines introduced so that to be fare in writing function for LinQ and ADO. As the code will be a shareware you are free to improve and build on it. The basic unit of measurement is counting ticks which have been used in this article ( System.StopWatch). Each piece of performance code has been run 500 times so as to get best performance values. Where ever possible I have added code to dispose/ garbage collect objects. All the code explained in this article is available in for download. The code is commented wherever required. Finally all the performance values are added to an Excel file Graphs.xls and visually shown by excel graphs. Logic for running the function 500 times is given below
The configuration used for getting the current performance data is given below OS Name Microsoft(R) Windows(R) Server 2003Ent Edition ,Version 5.2.3790 Service Pack 1 Build 3790Processor x86 Family Intel ~2992 MhzTotal Physical Memory 2,038.04 MBAvailable Physical Memory 872.52 MBTotal Virtual Memory 2.85 GBPage File Space 1.00 GBBackgroundWhat you need to run the samples
Before you begin read the followingIf you are not familiar with LinQ, new features of C# 3.0 please read the following urls
Using the code1. Inserting a row …
Function used for 2. Inserting a row …
Function used for 3.
Function used for 4. Reading xml files
Function used for 5. Accessing Objects (Arrays in this case) [Traditional vs. c#3.0 vs. LinQ]Function used for LinQ part is LinQObjects1 (), for the traditional c# part is csharpObjects1 () and for the c# 3.0 part is LinQObjects2 () in RetriveUsingLinQ.sln. All the functions first create an array of integers, and then crate a second array of only even numbers with their squares. The last step in the functions is to add all the values in the resultant subset. 6. Filling Dataset using LinQ and
Function used for LinQ part is LinQQueryDataset (), and that for the Points of InterestI have referenced the median value rather then the mean to help reduce the effect of out-liars in the graph as in a Windows operation system there are always more processes running and spikes in the graph does not necessarily means a fault of the code. · Inserting a row …
The median value of
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
LinQInsert |
|||
|
Mean |
102445.4 |
Mean |
40941.11 |
|
|
Median |
97645 |
Median |
39247 |
|
|
ADOInsertDirect |
LinQInsertDirect |
|||
|
Mean |
101625.8 |
Mean |
42324.78 |
|
|
Median |
96991 |
Median |
37634 |
|
|
ADORead |
LinQRead |
|||
|
Mean |
7162452 |
Mean |
14000818 |
|
|
Median |
7097164 |
Median |
13825471 |
|
|
csharpXMLReading |
LinQXmlRead |
|||
|
Mean |
108391.1 |
Mean |
98842.27 |
|
|
Median |
104622 |
Median |
92318 |
|
|
csharpObjects1 |
LinQObjects1 |
|||
|
Mean |
461.6407 |
Mean |
2965.475 |
|
|
Median |
402 |
Median |
2340 |
|
|
LinQObjects2 |
||||
|
Mean |
0 |
|||
|
Median |
0 |
|||
|
|
LinQ DataSet |
|||
|
Mean |
19159168 |
Mean |
24760066 |
|
|
Median |
19241882 |
Median |
24597140 |
| You must Sign In to use this message board. | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
|
General
News
Question
Answer ![]()