Find an Open Source Package
For this project, we will be analyzing and optimizing an open-source package, studying the source code of the package to determine CPU intensive aspects of the code and possible ways to increase performance. We will also be interacting with the open source community to discuss possible issues with the code as well as their compatibility with different processors, and then have the optimization accepted upstream.
We need to choose an open source package to optimize. We are looking for a package that includes a CPU-intensive function or method that is implemented in a language that compiles to machine code such as C, C++, or Assembler so we can optimize the code. I have decided to choose the open source compression software bzip2 which allows for compression and decompression, as well as many other things.
Benchmark the performance on AArch64
There are a few different files that I was looking at focusing on. I am going to be looking at the void compress (char* name) function in the bzip.c file. I have decided to pick this because it is a long function that has many switch, for, while, do while and if statements that have a lot of potential for various types of loop hoisting, loop unswitching, loop interchange as well as other potential code optimizations.
It is important to note you can use -1 (or –fast) to -9 (or -best) options to utilize, most optimizations and such, however I will run it as normal. The default runtime CFLAGS are -WALL -Winline -O2 -g, so I had to adjust the CFLAGS in the MakeFile to include a -pg to allow me to utilize gprof. However, being that it is a compression software, the files I was compressing to initially run bzip2, to generate that gmon file needed, would consistently throw the error of not being big enough. After generating a big enough file, compressing it and creating the gmon file, running gprof on it, I have run into a nice “unexpected end of file” statement, running into another wall. I am going to confer with a classmate and friend to see if we can resolve the error or come up with another course of action for the benchmarking.