As was shown in Embecosm Application Note 6 High Performance SoC Modeling with Verilator: A Tutorial for Cycle Accurate SystemC Model Creation and Optimization [10], compiler optimization has a very significant impact on performance.
The effect of compiler optimizations can be seen in Table 5.3. This compares the performance
using no optimization, optimization using -Os
(the
best for single pass optimization) and profile directed optimization
using -O3
and profile statistics from a debugging
run using the Ackermann's Function test program. To build a model
using profile directed optimization with optimization level
-O3
use the run-fast
target of
the Makefile
in the distribution.
make run-fast OPT=-O3
Run Description |
Cycles |
Time |
Perf |
Load Rate |
---|---|---|---|---|
No optimization(-O0) |
8,097,241 |
257.34 s |
31 kHz |
164 bytes/s |
Single pass optimization (-Os) |
8,097,241 |
124.71 s |
65 kHz |
383 bytes/s |
Profile directed optimization (-O3) |
8,097,241 |
92.69 s |
87 kHz |
487 bytes/s |
Table 5.3. Effect of compiler optimization on GDB server and client performance.
Using a single optimization pass more than doubles performance of both the server and client load times. Using profile directed optimization almost trebles performance.