Improving compilation time

From Second Life Wiki
Jump to navigation Jump to search

Improving compilation time

Based on the benchmarks below, the following conclusions were made:

  • The more RAM, the better. Enough RAM will make the hard disk's performance irrelevant.
  • Using a RAM disk for /tmp or even the full system doesn't noticeably improve performance if enough RAM is present.
  • Given enough RAM, the process will be entirely CPU bound.
  • A better hard disk will make a significant difference in link time if enough RAM can't be obtained.
  • Compiling using more processes (-j3 vs -j2) may be counterproductive if there's not enough RAM.
  • Gentoo compiled 15% faster.
  • Gentoo ran scons 50% slower.



  • Athlon 64 X2 5200+ (1MB cache)
  • 4GB ECC DDR2 666 RAM
  • Root on RAID-1, SAMSUNG HD300LJ and Maxtor 6V300F0



  • Gentoo, x86_64, gcc 4.1.1
  • Ubuntu Edgy, x86_64, gcc 4.1.2


Gentoo tests were done with /tmp on tmpfs.

Ubuntu tests were done with the whole install on /tmp on tmpfs, and the whole install on disk. This took about 1.5GB RAM:

  • 334MB for temporary files generated during compilation
  • 642MB for the source code
  • 462MB for the Ubuntu install (probably can be trimmed a bit)

Ubuntu tests were done as follows: Distribution was installed with debootstrap. Sources were copied into it (same copy as used for Gentoo). The whole tree, OS and sources included was copied to /tmp (on tmps), and chrooted into.

The "(on disk)" tests were done afterwards, by copying the whole tree (1.5GB) back to disk (as some changes were required to get the build going).

The "(after reboot)" were done as follows:

  1. Do required preparations (eg, binary removal)
  2. Reboot
  3. Login
  4. Chroot
  5. Build

X wasn't running during the tests.


Benchmark results
Test Timings Gentoo Ubuntu (after reboot) Ubuntu (on disk) Ubuntu (on RAM disk)
Full build Real 16m44.594s 19m23.391s 19m12.447s 19m5.572s
User 29m25.549s 35m15.595s 35m23.223s 35m24.639s
System 2m57.599s 2m9.673s 2m16.113s 2m13.387s
Rebuild Real 0m41.752s 0m27.656s 0m15.457s 0m15.444s
User 0m39.938s 0m14.858s 0m14.963s 0m14.771s
System 0m1.722s 0m0.952s 0m0.644s 0m0.784s
Relink Real 1m24.408s 1m17.616s 0m41.092s 0m41.268s
User 1m12.687s 0m37.895s 0m37.455s 0m38.016s
System 0m4.599s 0m4.360s 0m3.546s 0m3.258s