• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1028
  • Last Modified:

Speed of SqlDataReader vs SqlDataAdapter/DataSet

Has anyone done research/testing on using SqlDataReader vs SqlDataReader in C++.net?  I am just curious. I wrote code in C++.net thinking it would be faster than vb.net code. My testing shows that vb.net is just as fast for grabbing data from sql, doing a bit of math and updating sql. I thought it would be faster in C++.net, but it is managed code. I am using SQLDataReader in C++.
Thanks for any input!
Pam
0
pamwestphal
Asked:
pamwestphal
2 Solutions
 
Carl TawnSystems and Integration DeveloperCommented:
They should both be the same as they will, for the most part, compile to precisely the same IL code.

Unmanaged C++ should be faster than equivalent .Net code, but there shouldn't be much difference (if any) in speed for managed languages.
0
 
DanRollinsCommented:
Without doing any actual research, I can opine that the throughput bottleneck is nearly always the database access itself, rather than the code that wraps that access.  If you write "to the metal" -- direct access to the database drivers you might see a few % speed increase.  Otherwise, the performance will be very similar.

Anything that DOT NET does (or ADO or ODBC layer does) will burn a few CPU cycles, but the bulk of the data access time will be time spent by the DBMS driver in table scans to filter the recordset and to satisfy the SELECT statement and in I/O time spent transfering that data to your program.

Such things as a well-thought-out indexing strategy and selective record fetching will make much more difference in the overall speed of your database-intensive program than the specific tool you use to access the database.

-- Dan
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now