Solved

Optimization c++ code

Posted on 2002-03-08
5
219 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
[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
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

631 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