Friday, September 24, 2010

Testing RPM build times

The rpmmacros file
This week we were experimenting with the rpmbuild macros configuration file: ~/.rpmmacros.
The –j value of the smp_mflags in the ~/.rpmmacros file controls how many simultaneous jobs make starts and thus we can change it to see which value would give us the fastest build time.

The Setup
For the first test, I used my laptop, which is running Fedora12 in an Oracle VM VirtualBox virtual machine with 1GB of RAM allocated.
My laptop specifications are shown below:
CPU: Intel Core 2 Duo Mobile T5800 @ 2.00GHz
Ram: 4.00 GB

The package I chose to build was NLED.

The Test
The following command was used to gather the results: 
time rpmbuild -ba nled.spec

The Results
Values: -j1, -j3 (default), -j4, -j5
This resulted in an elapsed time of 15.8 seconds. Keeping in mind that this test is on Fedora running in a virtual machine, I ran it again. This time the result was16.9 seconds which I attributed to factors such as the CPU being used for other processes on the host machine. Values 1, 4 and yielded similar results of times between 15.8 - 16.9 seconds and value 5 yielded close to 18 seconds.

Best Value: -j2
However, using a value of j2 yielded an elapsed build time of 14.3 seconds, so it seems that this is the optimal value to use, at least in a virtual machine.

I re-did the test a second time after restarting the machine, and all the times dropped about 40% for each of the respective values!


Unsatisfied
I couldn't just have my cake and eat it too. I wanted seconds. So I pulled out the big guns and used my desktop with Fedora 13 installed.

The Setup Revisited
CPU:   Intel i7 920 Overclocked
Ram:   6GB

The Results Revisited
Blazing. 
No, really. The best value was a -j4 which yielded 3 seconds to build NLED.


I would definitely say that the benefits of changing the -j values of the smp_mflags would be more noticeable when compiling larger builds, but it was still interesting to test out the build times.

1 comment: