tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Should lang/clang use lang/libLLVM?



Joerg Sonnenberger <joerg%britannica.bec.de@localhost> writes:

> On Wed, Dec 30, 2015 at 06:01:05PM +0100, Tobias Nygren wrote:
>> On Wed, 30 Dec 2015 14:46:55 +0100
>> Benny Siegert <bsiegert%gmail.com@localhost> wrote:
>> 
>> > I noticed that there is a large amount of files that are duplicated
>> > between the clang and libLLVM packages, albeit with slightly different
>> > paths (e.g. include vs. include/libLLVM).
>> > 
>> > Is there a reason for this duplication? I would love to see clang
>> > depend on libLLVM, so that you can have both and not rebuild the world
>> > twice.
>> 
>> I was told by someone (on IRC?) that the statically linked compiler is
>> quite a bit faster, but can't remember who and have no numbers to back
>> up this assertion. Someone should benchmark this.
>
> For small source files, dynamic linking overhead is a factor of 10.

Does it make sense to you that the overhead of doing the linking of the
compiler binaries (assuming everything is in the buffer cache) is 10x
the actual run time of the compiler?

I generated a very small source file that just includes stdlib and has a
main taht calls exit.  It's hard to imagine anything real that is much
simpler.

on a netbsd-6 i386 box:

$ time sh -c 'for i in $(seq 1 1000); do gcc -c foo.c; done'
real    0m14.081s
user    0m8.836s
sys     0m4.786s

$ time sh -c 'for i in $(seq 1 1000); do clang -c foo.c; done'
real    0m24.070s
user    0m15.436s
sys     0m8.427s

That's with clang 3.7.0 as built from pkgsrc:
/usr/pkg/bin/clang:
	-lz.1 => /usr/lib/libz.so.1
	-lgcc_s.1 => /lib/libgcc_s.so.1
	-lc.12 => /usr/lib/libc.so.12
	-lpthread.1 => /usr/lib/libpthread.so.1
	-ledit.3 => /usr/lib/libedit.so.3
	-lterminfo.1 => /usr/lib/libterminfo.so.1
	-lstdc++.6 => /usr/pkg/gcc48/i486--netbsdelf/lib/./libstdc++.so.6
	-lm.0 => /usr/lib/libm.so.0
	-lgcc_s.1 => /usr/pkg/gcc48/i486--netbsdelf/lib/./libgcc_s.so.1

I don't see clang invoking anything else with ktrace.  Are you saying
with these libs linked statically it would be vastly faster?  Or is this
the static version because the llvm libs are in the binary:

-rwxr-xr-x  1 root  wheel  53959712 Dec  7 11:08 /usr/pkg/bin/clang

vs being linked dynamically also?   Then I'd see 240s?


----------------------------------------
#include <stdlib.h>

int
main()
{
  exit(0);
}

Attachment: signature.asc
Description: PGP signature



Home | Main Index | Thread Index | Old Index