CS25 - Lab 2
Part 5: Write-Up

Write a program to compare double precision floating point v. single precision floating point v. 32-bit integer v. 8-bit integer calculations (+, -, *, /). Keep the operands simple so the processor uses just registers (no arrays). Take care that you do the same number and type of operations and that you don't create dependencies in your code that hang up a superscalar architecture (see next task). Think carefully about how to do this so that the instrustructure (e.g. a for loop) does not play a significant role (> 20%) in the computation numbers.

Given that double and single precision floating point operations take up more memory than 8 or 16-bit integer operations, we expected the integer operations to be quicker. The integer operations were quicker than the floating point operations with the single precision being slightly faster than the double precision floating point operations. What we didn't expect was that the 8-bit integer operations would be slower than the 32-bit integer operations. We thought that smaller would be quicker in every case but since the processors in the machines were were using were better geared for 32-bit operations, the 32-bit integers were faster.

AMD Athlon XP
Cache Size 65536 bytes, Bytes/Line 64
Test Name Total Time (seconds) Time per Loop (nseconds)
Single Precision Test 1.765s 8.8 ns/loop
Double Precision Test 1.790s 8.9 ns/loop
8-bit Integer Test 3.289s 16.4 ns/loop
32-bit Integer Test 1.506s 7.5 ns/loop

Pentium 4
Cache Size 8192 bytes, Bytes/Line 64
Test Name Total Time (seconds) Time per Loop (nseconds)
Single Precision Test 2.889s 412.7 ns/loop
Double Precision Test 3.069s 438.4 ns/loop
8-bit Integer Test 0.081s 11.5 ns/loop
32-bit Integer Test 0.082s 11.7 ns/loop

PowerPC G4
Cache Size 32768 bytes, Bytes/Line 32
Test Name Total Time (seconds) Time per Loop (nseconds)
Single Precision Test 7.059s 70.6 ns/loop
Double Precision Test 7.005s 70.1 ns/loop
8-bit Integer Test 5.743s 57.4 ns/loop
32-bit Integer Test 5.701s 57.0 ns/loop