Code Profiling
- It is basically Performance-analysis.
- Code Profiling is basically used to improve the performance of the code.
-It helps to analyze the performance of the application and improve poorly performing sections of the code.
- It used by developers, without changing their code, to help identify performance problems.
- It can answer questions like how many times each method in code is called and how long does each of those methods take. It tracks things like memory allocations and garbage collection.
-Profiling is achieved by instrumenting either the program source code or its binary executable form using a tool called a profiler(or code profiler). Profilers may use a number of different techniques, such as event-based, statistical, instrumented, and simulation methods.
-Profilers use a wide variety of techniques to collect data, including hardware interrupts, code instrumentation, instruction set simulation, operating system hooks, and performance counters. Profilers are used in the performance engineering process.
Code Optimization
-Code optimization is any method of code modification to improve code quality and efficiency.
-A program may be optimized so that it becomes a smaller size, consumes less memory, executes more rapidly, or performs fewer input/output operations.
-Optimization of the code is often performed at the end of the development stage since it reduces readability and adds code that is used to increase the performance.
-Types of Code Optimization –The optimization process can be broadly classified into two types :
- Machine Independent Optimization – This code optimization phase attempts to improve the intermediate code to get a better target code as the output. The part of the intermediate code which is transformed here does not involve any CPU registers or absolute memory locations.
- Machine Dependent Optimization – Machine-dependent optimization is done after the target code has been generated and when the code is transformed according to the target machine architecture. It involves CPU registers and may have absolute memory references rather than relative references. Machine-dependent optimizers put efforts to take maximum advantage of the memory hierarchy.
No comments:
Post a Comment