Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

General question about efficiency

Status
Not open for further replies.

Valius

Programmer
Oct 20, 2000
174
0
0
US
I'm trying to streamline my programming more and more so that it doesn't take up very many resources. Since I'm doing a bunch with SQL, I'll be defining a bunch of Recordset objects which, in my opinion, are just a souped up version of a 2 dimentional array. My question is, would it be more resourcefull to open a record set, get my data, dynamically allocate an array through pointers then shove the data from my Recordset into that array then close my Recordset? Now, I wouldn't do this for Recordsets that I am constantly refreshing, but for Recordsets that are static and I keep through my program. To me, the dynamically allocated array would be quicker in finding the info and probably take up less resources....because once I have my data in an array, I can get rid of both my Recordset object and my Connection object (in some instances). Thanks for any input anyone may have on this subject.

Niky Williams
NTS Marketing
 
Niky,

If you are talking about optimization of existing software you should use tools like profilers to identify the parts of the code that need attention. Without the use of such tools, people guess which places code optimization will benifit the software. Those guesses are often wrong, resulting in hours of work performed with little to no benifit.

"But, that's just my opinion... I could be wrong".
-pete
 
While the previous commentor is correct using a profiling tool will help you identify where the inefficiencies are in your software. If you don't have access to a profiler try making a smaller project that focuses on a potential issue. Use a timing class to record how long two different versions of a potential issue take. This essentially your own mini-profiler.
 
I never thought of that....that's a cool idea. Thanks!

Niky Williams
NTS Marketing
 
Ben,

> This essentially your own mini-profiler.

I don't believe I can agree with that comparison. Using a profiler during a real-world run case of your application will provide information as to what code locations are taking the most processing time for that 'use case'.

Using the technique you discuss can be of great value once the 'code location' has been identified. Using it as a complete solution still leaves you guessing at what code needs to be optimized.

"But, that's just my opinion... I could be wrong".
-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top