Project solution

In spo600 course, I took FLIF as my project.

FLIF is a picture format that is able to lossless compress pictures.

There are 3 stages for the project: Benchmarking, Profiling and optimizing.

In the first stage, I found the project and benchmarked the program using the use case that built by my self. If you are interested in that, please go to my previous posts.
To identify the effects of compiler optimization flags, I tried to compile and run the program with different optimization levels by modifying the Makefile.

One thing surprised me was that O3 and Ofast does not provide the fastest performance, O2 does.

Then I moved to second stage, the profiling. In this stage, I found the function that takes most of time to run and tried to understand it.

That was a clean code. It does not contains too much high-end C++ feature, but only used template and class from C++, other codes looks like C code.

That allows me to understand the code easily. After I looked at the code, I thought that it is hard to optimize the code because it is clear enough: there are almost no obvious logic and syntax issues that result in performance issues.

In the final stage, I tried to use multiple-threading to speed-up the program. It actually work. The function that takes most time to run was complete so that it is hard to move it to multiple-threading – actually that logic should not be done with different threading. Just like render a image, each thread should render only one part, instead of one part being rendered by multiple thread. So I cut the image into 4 different fragments and compress the 4 fragments by the program at the same time. the program takes less time in the real.(not the cpu time, the cpu time should be used a little more).

Leave a comment

Design a site like this with WordPress.com
Get started