# Pipeline Calculations: how many clock ticks will it take to execute a sequence of instructions?

## Let's say that there are 1234 instructions in the sequence and 5 ticks per instruction.

## If there is no pipeline, we multiply:

### The number of clock ticks for a sequence of instructions is the product of
the number of ticks per instruction and the number of instructions in the sequence

### The number of ticks for our example sequence would then be 5 * 1234 = 6170

## If there is a pipeline, we add:

### The number of clock ticks for a sequence of instructions is the sum of the number
of ticks per instruction and the number of instructions in the sequence minus 1

### How do we know that?

- The number of ticks to get the first instruction done is just the number of ticks per instruction.
- Once that is done, the number of instructions left to do is one less than
the number of instructions in the sequence.
- Once the first instruction completes, another instruction completes in each following tick.

### The number of ticks for our example sequence would then be 5 + 1233 = 1238

### Compare 6170 to 1238 to get an idea of the speedup we get from pipelining.