How long does it take...
- To install a specific module?
- To install the ISO?
- To recompile all my modules?
These questions get asked a lot by new lunar users and it is a very logical question: Lunar is after all a source distro and requires you to compile all the applications from source, which can sometimes take extremely long!
- System(CPU) speed
Double the CPU MHz, and you double the amount of instructions that a system can make per time unit. So, as a rule, a faster CPU results in faster compiles.
- Memory size
Compiling may require large amounts of memory, especially when compiling C applications. Generally, a compilation will go 50% faster if you have double the memory. So, if you only have 128MB of memory, you will speed up your compiles by 225% by increasing the amount of memory to 512MB. This might be worth the trip to the hardware store.
- Idle time
Compiling takes a long time. Every second that your system is doing something else, especially interactive tasks, reduces the amount of time that your system can compile applications.
- System architecture and components
Needless to say that a compile on a SATA hard disk is a lot faster than on a ATA-33 system. Especially with larger modules this is a very important factor.
Some basic numbers
The following numbers are from a Pentium 4 laptop system with 256 MB, running at 1.8GHz. This is a fairly normal system and if you wish to compare it with your own system, you should keep in mind that this system might be relatively slower or faster based on the influencing factors mentioned earlier.
The modules listed below are very common modules, so they should give you some good insight in how long it takes to compile and install something. Based on the size you can make rough estimates for new modules that you wish to install.
module source size installed size compile time gcc 27.6 257.3 120:45 XOrg 48.2 93.8 68:07 glibc 13.5 64.7 47:09 gtk -2 11.8 34.5 26:08 perl 9.8 52.3 17:50
As you clearly can see there is some correlation between installed size and compile time, but there are many outliers in this trend: gtk -2 comes with a lot of bitmaps and documentation, while the XOrg tarball is counted without documentation. The gcc compiler itself has a very elaborate bootstrap phase that takes almost half the time it takes to compile the target compiler. Many many module-specific factors are at work here.
Estimating compile time
If you correlate the size of the installed product or the source code size (in compressed form easily available), you get a very loose correlation shown in the graph below:
Above is correlated by install size (uncompressed size in kB against compile time in seconds), below is correlated against the size of the compressed source code tarballs (same scale).
As you can see there is a faint correlation possible. Most applications install about 10kB of product in 1 second. The other way around you can reason that it takes 1 second to compile 10kB of (compressed) source code. This allows you to pre-estimate the compile time, assuming that your system is the same speed as my reference system.
We can do some more elaborate math on this and calculate the "index" for all modules. The index of a module would be easily calculated by the amount of time it took for lunar to compile and install 10kB of compressed source code. So we divide the total compile/install time (seconds) by the number of kilobytes that the compressed source package was:
gcc took 8025 to compile install 26952 compressed kB of source code == 3.35 XOrg took 4087 to compile install 47656 compressed kB of source code == 11.6
If we do this for all modules we end up with the average index of about 27, which means that on average, lunar compiles and installs 27kB of compressed source code per second. Since the size of my /var/spool/lunar is about 1.4gB, it would take me about 51851 seconds to compile and install all of this source code files. That's about 14.5 hours! Of course that number really is not right - we haven't taken into account that larger modules might have a lower index and thus take much longer to compile.
We should be able to index the numbers of all modules right now, so it pays off to pay a closer look at the numbers a bit. Most importantly, the 27 index is averaged across all modules, but we know that this number is off for bigger modules. For modules larger than 100kB source size, it's already 32, and for modules over 1000kB, it's up to 52. This seriously changes perspective and shows you that smaller modules take relatively longer to install, and this is not surprising: the overhead is usually much larger for them, as all the autoconf and administrativa needs to be performed for smaller modules as well.