C++ recordsets vs. C# data readers

  • Thread starter Thread starter lakshmi
  • Start date Start date
L

lakshmi

Hi all,
I recently rewrote a data intensive C++ program in C#.
The C++ program was traversing 3 recordsets that were all
open at the same time. I replaced those 3 recordsets with
3 .NET data readers and found that my C# code takes only
about 35% of the time that the old C++ program took to
execute. I'm amazed at this performance improvement, but
finding it hard to believe. I'm supposed to make a
recommendation based on my test results.

1. I've read that data readers are highly optimized for
forward only, read only recordsets. Have you found data
readers to be highly performing compared to C++ recordsets.

Please let me know your experience. (I want to make sure
that DataReaders are truly really high performing than C++
recordsets.)

Thanks for sharing your thoughts.
 
Hi -

Is your C++ application using a client side cursor? If it is not then the
request for records will be going over the wire and taking longer to
process.

Simple change to make, once you open the connection then set the following
property:

m_comm.CursorLocation = adUseClient;

I believe data readers cache client side already so this could be
contributing to the speed increase that you are seeing.

If you are not amending the data (only reading) then also ensure that the
lock is using adLockReadOnly (on call to Recordset Open method).

If you have a choice between .NET or the old VS98, then I'd definitely opt
for .NET; the database support under C# is excellent and it also makes
utilising XML very easy (should you need to go down that route).

HTH

- Andy
 
Back
Top