Solved

Improving the speed of a C program

Posted on 2002-04-18
4
167 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Binary Bomb: Phase 4 func4 3 334
Concatenate two strings Last and First Name 10 60
C hashtable library 3 93
Constant string is of type char *   ? 7 31
Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
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…
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.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

831 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