Solved

Optimization c++ code

Posted on 2002-03-08
5
215 Views
Last Modified: 2006-11-17
I'm looking for information, tools and software about How to optimize code using intel processor and C++.
0
Comment
Question by:i32tomar
  • 3
5 Comments
 
LVL 11

Expert Comment

by:griessh
ID: 6850504
Turn on the optimization of your C++ compiler ...

======
Werner
0
 
LVL 11

Expert Comment

by:griessh
ID: 6850523
I think you have to explain first WHAT you want to optimize. You can optimize memory usage (usually means slower execution), execution time, access time to external ressources. Most modern compilers are using better optimization that you can hand-code. If you want to optimize the app even more, spend more time on the design of your data flow, the type of objects and the libraries you want to use.

Depending on your OS you will be able to use performance tools to find bottlenecks in your code.

======
Werner
0
 
LVL 16

Accepted Solution

by:
imladris earned 10 total points
ID: 6850725
In general far too much time is spent trying to optimize "code". The best approach is to proceed to completion of the project, whatever it is. Then, if optimization is needed or desired, you start by profiling the code. In terms of speed, a computer normally spends 80% of its time executing 20% of the code. With the profiler you can identify the bottlenecks, and then spend optimization effort where it is going to have some noticeable benefit.
0
 
LVL 3

Expert Comment

by:jtm111
ID: 6851103
To these comments I would add that using solid programming constructs is a good route to fast and clean code. A good programmer could write faster code in Visual Basic than a less effective programmer writing a C++ program with full optimization if the VB programmer used a smarter approach.

You will find there are dozens of areas where you could look to improve your code. Use of inlining, dynamic memory allocation, exception handling, passing arguments by reference, etc.

A widely acknowledged book on good programming practices for intermediate-advanced programming is Scott Myers: Effective C++.

0
 
LVL 11

Expert Comment

by:griessh
ID: 6955310
Dear i32tomar

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to accept

     "griessh"

comment(s) as an answer.

If you think your question was not answered at all, you can post a request in Community support (please include this link) to refund your points. The link to the Community Support area is: http://www.experts-exchange.com/commspt/

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

867 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now