So I basically set the volume to max, run my loop, and set the volume to min again:
Code: Select all
move.l #7000, %d0 | set Loopcounter
move.b #0x00,0xA04001 | set Volume of Sinewave
countCycles_l1:
asl.l #2, %d1 | do something
sub.l #1, %d0 | decrement loop
bne countCycles_l1 | loop
move.b #0x7F,0xA04001 | mute sinewave
Code: Select all
Code lies in | Loop reads | loop iterations
1. ROM | - | 7000
2. ROM | - | 14000
3. ROM | ROM | 7000
4. ROM | RAM | 7000
5. RAM | - | 7000
6. RAM | - | 14000
7. RAM | ROM | 7000
8. RAM | RAM | 7000
Code: Select all
time measur.| time predic.| difference
1. 0,0280625 | 0,027632181 | 1,53%
2. 0,05615625 | 0,055261995 | 1,59%
3. 0,031833333 | 0,031316156 | 1,62%
4. 0,03634375 | 0,035000132 | 3,70%
5. 0,0283125 | 0,027632181 | 2,40%
6. 0,05665625 | 0,055261995 | 2,46%
7. 0,03215625 | 0,031316156 | 2,61%
8. 0,03590625 | 0,035000132 | 2,52%
- - Everything is slower than it should be.
- The Difference between the percentages of test 1 2 and 3 are so small, that it's possible they are due to measurement inaccuracy. Same for tests 5/6/7.
- RAM is slower generally, but comparing test 4 vs test 8, RAM is actually faster.
1. My cpu runs slower than it should, about 7.48mhz. Is this likely?
2. There is a speed penalty for using ram. Does someone know if you can actually calculate how big it is?
3. There might be caching involved or something. Otherwise I wouldn't know how the difference between test 8 and test 4 could be in this direction.
Note: I measured everything twice, to see if there would be a significant error in measurement. The range of difference between my first and my second measurement was 0,0000313 seconds with most differences being smaller.