Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is code optimization?

When said this code need some optimization, or can be some how optimized, what does that mean? which kind of code need optimization? How to apply optimization to the code in c#? What the benefits from that?

like image 271
Abdullah BaMusa Avatar asked Feb 12 '09 06:02

Abdullah BaMusa


People also ask

What is meant by code optimization?

Code optimization is a program modification strategy that endeavours to enhance the intermediate code, so a program utilises the least potential memory, minimises its CPU time and offers high speed.

What is code optimization with example?

Optimization is a program transformation technique, which tries to improve the code by making it consume less resources (i.e. CPU, Memory) and deliver high speed. In optimization, high-level general programming constructs are replaced by very efficient low-level programming codes.

Why do we use code optimization?

Code optimization increases the speed of the program. Resources: After code optimization our program demands less no of resources thus it saves our resource(i.e, cpu, memory) for other programmer.

How can we optimize the coding?

Optimize Program Algorithm For any code, you should always allocate some time to think the right algorithm to use. So, the first task is to select and improve the algorithm which will be frequently used in the code. 2. Avoid Type Conversion Whenever possible, plan to use the same type of variables for processing.


1 Answers

Optimization is a very broad term. In general it implies modifying the system to make some of its aspect to work more efficiently or use fewer resources or be more robust. For example, a computer program may be optimized so that it will execute faster or use less memory or disk storage or be more responsive in terms of UI.

Although "optimization" has the same root as "optimal", the process of optimization does not produce a totally optimal system: there's always a trade-off, so only attributes of greatest interest are optimized.

And remember:

The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet. (Michael A. Jackson)

like image 125
Anton Gogolev Avatar answered Oct 20 '22 15:10

Anton Gogolev