Hello friends , good morning to all readers , first why i choose this topic , i choose this topic because the term OPTIMIZATION used too much in raw-material of languages .
Here i want to explain the basic thing or why it is used in languages and what is the thing behind it , that it is used too much in raw-material of language . "optimization" is a term used with some different thinking , when you write any code and after compilation it is changed into machine understandable code .
when any code changes into machine code , before it at intermediate level many optimization steps are taken . they are some-thing like that :-
write a code :---- ( images from wiki-pedia )
after first optimization :--------
after second optimization :-------
after third optimization :-------
now in what basics these optimization steps are carried-out .
these steps are carried out in the basics of constant folding and constant propagation.
constant folding :-
constant folding is a term which means that solving constant expression when they are needed .
constant propagation :-
constant propagation is term which means that passing you constant values with the help of some variable to some other expression .
int a = 10 ;
int z = 20 + a ;
at the compilation time , the value is passed to the expression is very accurately processed , because if you process it with some false thinking than at the compilation it can create some problem , so optimization is very necessary in all languages .
Here i want to explain the basic thing or why it is used in languages and what is the thing behind it , that it is used too much in raw-material of language . "optimization" is a term used with some different thinking , when you write any code and after compilation it is changed into machine understandable code .
when any code changes into machine code , before it at intermediate level many optimization steps are taken . they are some-thing like that :-
write a code :---- ( images from wiki-pedia )
int a = 30;
int b = 9 - a / 5;
int c;
c = b * 4;
if (c > 10) {
c = c - 10;
}
return c * (60 / a);after first optimization :--------
int a = 30;
int b = 3;
int c;
c = 3 * 4;
if (c > 10) {
c = c - 10;
}
return c * 2;after second optimization :-------
int c;
c = 12;
if (12 > 10) {
c = 2;
}
return c * 2;after third optimization :-------
return 4;
now in what basics these optimization steps are carried-out .
these steps are carried out in the basics of constant folding and constant propagation.
constant folding :-
constant folding is a term which means that solving constant expression when they are needed .
constant propagation :-
constant propagation is term which means that passing you constant values with the help of some variable to some other expression .
int a = 10 ;
int z = 20 + a ;
at the compilation time , the value is passed to the expression is very accurately processed , because if you process it with some false thinking than at the compilation it can create some problem , so optimization is very necessary in all languages .
No comments:
Post a Comment