Solved

Improving the speed of a C program

Posted on 2002-04-18
4
172 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand and use pointers 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.

615 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