I got a lot of time consuming compilation 64 bits apps but now I have speed up the compilation time about 1000x!!! I want to share with you the 2 tweaks:
This is only valid for high RAM (8 GB in my PC)
Ubuntu 16.04:
-Moving Temporary Files to Memory (RAM):
Before starting this process its a good idea to backup the fstab file:
sudo cp /etc/fstab /etc/fstab.bak
The next step is to edit fstab:
sudo gedit /etc/fstab
Add the following lines at the end of the file :
tmpfs /tmp tmpfs defaults,noatime,size=1G,mode=1777 0 0
tmpfs /var/tmp tmpfs defaults,noatime,mode=1777 0 0
tmpfs /var/log tmpfs defaults,noatime,mode=0755 0 0
tmpfs /var/log/apt tmpfs defaults,noatime 0 0
Other tweak:
The swappiness value determines how much data is written to the virtual memory on the hard disk drive, which can slow your system down. Begin by opening a Terminal and entering:
cat /proc/sys/vm/swappiness
The default swappiness value in Ubuntu is 60.
Next, open the /etc/sysctl.conf file in a text editor:
gedit /etc/sysctl.conf
Scroll to the bottom and add the following parameter (and the associated note as a reminder):
Decrease swappiness value
vm.swappiness=2
With this done, save the file. Unusually for Linux, youll also need to restart the computer. Once booted up again, confirm the swappiness value has changed.
Now compilation time is instant for me!!!