0

What is code optimization ???

19th May 2018, 10:55 AM
Muhammad Haaris
Muhammad Haaris - avatar
2 Answers
+ 5
To put that definition into perspective, think about this code: x = 5 y = 10 a = y + x + 5 b = y + x - 5 Without optimization, y + x would be calculated twice. During the figuring out what is to be assigned to a and once more to figure out b. With optimization, the compiler looks for things that happen multiple times and tries to only do it once. It also looks for special cases such as divide by 2 as the shift instruction is much faster than the divide instruction.
19th May 2018, 12:08 PM
John Wells
John Wells - avatar
+ 5
Acording to Wikipedia: "In computer science, program optimization or software optimization is the process of modifying a software system to make some aspect of it work more efficiently or use fewer resources."
19th May 2018, 11:11 AM
Ulisses Cruz
Ulisses Cruz - avatar