|
|
Auswirkungen eines Compilers
Annahme:
| Befehlsklasse: |
CPI: |
| A |
1 |
| B |
2 |
| C |
3 |
- 2 verschiedene Compiler für das selbe Programm erzeugen 2 unterschiedliche Code Sequenzen.
| Code Sequenz: |
Anzahl der Befehle für die einzelnen Klassen: |
Gesamt: |
| A |
B |
C |
| 1 |
2 |
1 |
2 |
5 |
| 2 |
4 |
1 |
1 |
6 |
- Die Anzahl von Clock cycles ergibt sich aus:
| CPU clock cycles (1) |
= |
(2 x 1) + (1 x 2) + (2 x 3) |
= |
10 |
| CPU clock cycles (2) |
= |
(4 x 1) + (1 x 2) + (1 x 3) |
= |
09 |
- Compiler 2 produziert einen Maschinencode der 1 Befehl länger ist, jedoch von diesem Prozessor um 1 Tick schneller ausgeführt wird.
| CPI (1) |
= |
CPU clock cycles (1) |
= |
10 |
= |
2 |
| Instruction count (1) |
5 |
| CPI (2) |
= |
CPU clock cycles (2) |
= |
9 |
= |
1.5 |
| Instruction count (2) |
6 |
- Performance hängt von 4 Komponenten ab:
- Instruction count
- CPI
- Clock rate
- Compiler
|