CS401 Computer Architecture and Assembly Language GDB Solution 2014

Suppose we have TEGRA, a multi-core mobile processor. While writing an application in assembly language for the given device, we have two options regarding code optimization.

Option A: Do necessary optimization steps before and then write the code.

Option B: First code the program in a normal way and then make necessary changes in order to optimize it.

Can we prefer any approach over the other or both are acceptable. Justify your answer with logical reasoning.

Solution: I would prefer Option B because The optimization process is not cheap. If you develop a program and then determine that it is too slow, you may have to redesign and rewrite major portions of that program to get acceptable performance.

Optimizing early may create so many additional program errors that you lose any time saved by not having to optimize the program later in the development cycle. The correct time to optimize a program is, well, at the correct time. Unfortunately, the “correct time” varies with the program. However, the first step is to develop program performance requirements along with the other program specifications. The system analyst should develop target response times for all user interactions and computations. During development and testing, programmers have a target to shoot for, so they can’t get lazy and wait for the optimization phase before writing code that performs reasonably well. On the other hand, they also have a target to shoot for and once the code is running fast enough, they don’t have to waste time, or make their code less maintainable; they can go on and work on the rest of the program. Of course, the system analyst could misjudge performance requirements, but this won’t happen often with a good system design.