[wpdreams_ajaxsearchpro_results id=1 element='div']

What’s Program Optimization?

[ad_1]

Program optimization improves a program’s speed, efficiency or resource usage. It can be done automatically by compilers or manually by programmers. Optimization has trade-offs and can make code less readable or flexible. Different types of optimization can be done at different stages of development. Automated optimizations can involve complex tricks, but too much optimization can make code difficult to modify or read.

Program optimization is the process of modifying a computer program so that the program runs faster, consumes fewer resources, or generally runs at a higher level of efficiency. The optimization task can be done automatically by some programming language compilers, intentionally using an optimizer program, or manually by programmers who examine the source code and attempt to make specific improvements. In general, program optimization is done with a specific end in mind, because there are very few general optimizations that can be done to a program that don’t somehow reduce the optimized state of another part of the program, which means that a program can usually be optimized for speed or resource usage, but usually not both. One complication that can occur with some types of optimization is that many high-level programming languages ​​provide such a high level of abstraction between native code and computer language that optimization can be difficult or impossible to implement across platforms in all situations, especially with interpreted languages ​​that use just-in-time (JIT) compilation.

An important concept in program optimization is the idea that an optimization usually has some kind of price tag. An example of this is that when a piece of code is optimized to run faster, the speed increase could come at a price in code readability, memory usage, program flexibility, or a number of other costs. This means that program optimization must be a focused process, with the intention of making one aspect of a program work better while being willing to sacrifice the efficiency of other aspects.

Different types of program optimization can be performed at different stages of program development. During design, extensive optimization can be done to ensure that a program appears to work effectively. When working with actual source code, optimizations can include making sure there are no extraneous commands, repetitive calls, or poorly written functions. At compile time, many optimizations are performed automatically by the compiler and can be driven by the programmer through the use of various compiler options or directives.

Automated optimizations, such as can occur with a compiler or dedicated optimization program, can often involve tricks that are too complex to be practical for human programmers. This can involve moving instructions in a program to execute out of the order originally written but in a more processor-efficient way. It can also involve intentionally moving resources such as blocks of memory so that they can be accessed faster. Most program optimization happens automatically at the compiler level.

A complication with repeated or aggressive program optimization is that once a program has been modified to run more efficiently, it generally becomes more difficult to modify it for other purposes, such as adding features or fixing bugs. This can occur when optimizations begin to block set program behaviors that cannot be easily changed or adapted to new code without requiring all optimizations to be undone. A bigger problem is that, in many cases, an optimized program becomes less human-readable, because tricks and shortcuts are used instead of just terse commands and classical control structures. For these reasons, there is often a level of program optimization at which it is acceptable to stop, even if drastic code changes might make a program run slightly more efficiently.

[ad_2]