Sunday, November 8, 2015

Algorithm Selection

A couple of weeks ago, we were asked to write two different approaches to adjusting the volume of sound samples. The two approaches we were asked to write was:
  • Scaling the values of sound sample by multiplying value by a scaling factor.
  • Scaling the values of sound sample by multiplying value by a scaling factor and storing it into a lookup table. So, when the program needs the data it will provide it from lookup table until the scaling factor isn’t changed.

To analyze the performance I’ll be using the Archie system (CDOT's ARMv8 - AArch64) and Xerxes system (CDOT's x86_64). I’m going to be using data type int16_t (16 bits) to represent a sound sample and providing 5,000,000 samples which adds up to 10MB of sound sample’s volume to adjust.
To calculate the performance of each approach I first made a dummy run of the program to get its performance without adjusting the volume. In this the program just creates a 10MB of sample data and prints out all its values.  Then I calculated the performance on each approach of volume adjustment. I made five runs on each approach on each system.

Performance on Archie:
Tests
1
2
3
4
5
Dummy run
10.86s (11392 KB)
7.79s  (11328 KB)
10.82s  (11328 KB)
7.49s  (11328 KB)
10.82s  (11392 KB)
Multiplication
9.54s  (11328 KB)
9.50s  (11392 KB)
12.15s  (11392 KB)
9.06s  (11392 KB)
11.99s  (11392 KB)
Lookup Table
7.96s  (11584 KB)
11.39s  (11584 KB)
7.37s  (11584 KB)
11.39s  (11648 KB)
11.42s  (11584 KB)

Performance on Xerxes:
Tests
1
2
3
4
5
Dummy run
0.86s  (12416 KB)
0.85s  (12360 KB)
0.87s  (12368 KB)
0.85s  (12364 KB)
0.93s  (12392 KB)
Multiplication
0.92s  (12308 KB)
0.90s  (12416 KB)
0.91s  (12316 KB)
0.91s  (12424 KB)
0.86s  (12472 KB)
Lookup Table
0.93s  (12448 KB)
0.95s  (12496 KB)
0.92s  (12524 KB)
0.94s  (12608 KB)
0.92s  (12540 KB)

As you can see results from Archie system is inconsistent in terms of run time, but the memory usage of the program is consistent and Xerxes system is providing consistence run time and memory usage. By looking at these stats we can say that Xerxes system is faster in performing these tests.

The average run time on Archie system is: 9.556s on dummy run, 10.448s on multiplication, and 9.906 on the lookup table; and the average run time on Xerxes system is: 0.892s on dummy run, 0.900 on multiplication, and 0.932s on the lookup table. Using the average we can calculate the run time of adjusting volume on Archie system is: 0.892s on multiplication method and 0.350s on lookup table; and for Xerxes system is: 0.008s on multiplication method and 0.04s on lookup table method. You can also see that Xerxes system consumes more memory than Archie system. So, based on these results I would say that the approach of adjusting volume depends on the system you are using.

No comments:

Post a Comment