SPO600 Lab 5

 In lab 5, I handed on an experiment where I benchmarked c programs that simulate the process of scaling volumes using different algorithms.

The programs are separated, and this would cause inconsistent results because, for each run time, programs would create different random data of samples. Thus, I combine them into one to have a more reliable result for using mutual samples. Furthermore, I also set the number of samples to 300000, and the number of benchmark tests is 10000. For each test, I store the timer for each algorithm. In the end, I print the average time each algorithm takes. Here is my repository on GitHub: https://github.com/willvuong168/SPO600-Lab-5

Taking the advantage of a C++ course that I am taking, where I already had a timer program. All I have to do is put the timer before and after each scaling function. Before making an all-in-one program, each algorithm sums the sample's output and prints it out to the screen because each algorithm may produce a different result. Some of them may lose data because of converting between types of numbers.

On my Windows PC, which uses X86_64 architecture, here is the benchmark result:

vol0.c took 23.2293 s average

vol1.c took 23.2302 s average

vol2.c took 23.2312 s average

The first algorithm is the fastest, while the third program, which uses the same algorithm, but a different method, took the longest time. I guess the factor that made the third program take more time than the first program is casting types. Vol2 has five casts while vol0 has 3. So that makes the difference. Although vol1 uses less cast, the program is still not faster than vol0. Maybe it is due to the bitwise operator.

 

Comments

Popular posts from this blog

SPO600 Lab 2

SPO600 Lab 1

SPO600 Lab 3