Solved

Improving the speed of a C program

Posted on 2002-04-18
4
168 Views
Last Modified: 2010-04-15
Does anyone know a good site which covers improving the execution speed of a C program with register variables, inline functions and the like?

Rob
0
Comment
Question by:rd707
  • 2
4 Comments
 
LVL 5

Expert Comment

by:nebeker
ID: 6951365
Before you go off and start changing variable types (to use "register") and other small-fry type changes, I would suggest that you first profile your application, to find out where the bottlenecks really are.

An excellent (but expensive) tool for this is Quantify from Rational  (http://www.rational.com/products/pqc/index.jsp).

After running the profiler, it will show you the three most important things you need to know before you start optimizing a program:

 * which functions are called the most often
 * which functions are the slowest
 * where your program spends a majority of its CPU time

Once you have this information, you can start digging into the appropriate functions.  But just randomly inlining functions, or changing your variable prototypes aren't going to work...

As the saying goes, 20% of your code does 80% of the work -- so find that 20% before doing anything else.
0
 
LVL 12

Accepted Solution

by:
guidway earned 50 total points
ID: 6951895
0
 
LVL 4

Author Comment

by:rd707
ID: 6952853
Excellent - many thanks.

rd707
0
 
LVL 12

Expert Comment

by:guidway
ID: 6953704
Glad to be of help. Thanks for the grade!

guidway
0

Featured Post

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question