Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Speed Up linking speed / Fast linking on linux

Tags:

c++

linux

linker

I am building webkit ( 2 Million lines of code) after every ten minutes to see the output of my change in it, and linking of webkit on my Machine requires to process 600-700 MB of object files which are there on my hard-disk. That takes around 1.5 minutes. I want to speedup this linking process.

Is there any chance that, I can tell os to keep all the object files in RAM only ( I have 4 GB of ram ). Is there any other way to speed up the linking?

Any ideas or help is appreciated!

Here is a command which takes 1.5 minutes,

http://pastebin.com/GtaggkSc

like image 466
SunnyShah Avatar asked Sep 12 '10 15:09

SunnyShah


1 Answers

I solved this problem by using tempfs and gold linker.

1). tmpfs: mount directory which contains all the object files as tmpfs.

2). gold linker: using gold linker will make linking 5-6 times fast, with tmpfs advantage speedup will be 7-8 times than normal linking. use following command on ubuntu and your normal linker will get replaced with Gold Linker.

sudo apt-get install binutils-gold

You can find some linking error using gold linker, below thread is a good help on it.

Replacing ld with gold - any experience?

like image 200
SunnyShah Avatar answered Oct 04 '22 16:10

SunnyShah