Structural Optimization Flashcards

(10 cards)

1
Q

What is the first optimization?

A

Strength Reduction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the second optimization?

A

Loop Unwinding

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the third optimization?

A

Loop-Invariant Code Motion

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the fourth optimization?

A

Copy Propagation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the fifth optimization?

A

Tail-Recursion Removal

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is an example of strength reduction?

A

Simplifying mathematical operations, such as:
- changing multiplication by powers of 2 to bit shift
- changing small multiplication values to several addition functions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is an example of loop unwinding?

A

Reducing the number of iterations a loop needs to complete, such as:
- if a loop executes twice, remove the loop and add the body twice
- if a loop has only a method calling using the declared variable, and has a significant number of iterations to complete, reduce the number of iterations by calling the method several times with the updated value as needed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is an example of loop-invariant code motion?

A

Moving constant operations that never change outside of the loop, so that they are only calculated once

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is an example of copy propagation?

A

When a variable is assigned a value, but the variable is never used, ignore the variable and in its place you the assigned value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is an example of tail-recursion removal?

A

Converting the function using tail-recursion to a loop, where the needed variables are declared outside the loop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly