performance analysis and optimization. performance: time space power (cost) (weight) {development...
Post on 20-Dec-2015
223 views
TRANSCRIPT
Performance Analysis and Optimization
Performance:TimeSpacePower(cost)(weight){development time, ease of maintenance,
extensibility}
Note: 1. “big-O” analysis not sufficient here, we are dealing with specific physical sizes
2. notation “big-O” often really means Θ
Arithmetic—basic algorithmsHierarchy of time complexity:
increment / decrementaddition / subtraction
multiplicationdivision / square root
other operations
can usually trade off time for spaceExample: addition of 2 16-bit numbers
carry-ripple adder: time - 31 gate delays space - 16 full adderscarry lookahead adder (4-bit units): time – 8 gate delays space – 4 4-bit CLA units—more gates, routing
fig_14_00
Example: summing array elements—linear in size of array
table_14_00
How to analyze performance and Do optimizations
fig_14_01
Rates of growth for commonly encountered complexity:Asymptotic complexity
fig_14_02
Time complexity: loop
fig_14_03
How does this differ from previous example?
fig_14_04
While loop
fig_14_05
Nested loops—example:
fig_14_06
Time complexity of conditional statements:
fig_14_07
Linear search:
fig_14_08
Selection sort:
Common data structures (not dynamic):
Array:
O(n) [move]:
Insert / delete at beginning
Insert / delete at end
Insert / delete in middle
O(1):
Access at beginning
Access at middle
Access at end
Common data structures (not dynamic):Linked list:O(1):
Insert / delete at beginning access at beginning
O(n):insert / delete at end (or O(1) if extra pointer)insert / delete in middleAccess at middleAccess at end (or O(1) if extra pointer)
fig_14_09
Flow of control:sequential
fig_14_10
Loops/conditionals
fig_14_11
Example: loop
fig_14_12
Example: function call
fig_14_13
Code: C level
fig_14_14
Code: machine instruction set level
fig_14_16
If—2 levels
fig_14_18
While-2 levels
fig_14_19
Function call—machine level
fig_14_20
Function—C level
fig_14_21
What happens at machine level
fig_14_22
Function body– c level
fig_14_23
Function body—machine level
fig_14_24
Co-routines
fig_14_25
interrupts
fig_14_26
Response time—2 systems
fig_14_27
Best and worst case times
fig_14_28
Asynchronous events
fig_14_29
Memory: hierarchy / response times
table_14_03
Power usage for some common operations
fig_14_30
Power—sophisticated management possible
fig_14_31
Using a power manager
fig_14_32
Power management schemes
fig_14_33
Standard power modes
table_14_02
Ways to analyze performance during development