tech-pkg archive

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

Re: Should lang/clang use lang/libLLVM?

On Wed, Dec 30, 2015 at 01:14:30PM -0500, Greg Troxel wrote:
> > 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?

The dynamically linked binary has to patch up all the vtables etc, that 
is a significant chunk of the total runtime for trivial input. Given 
that it has to do it twice, it matters a lot.

> 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 fishy, something is wrong with the build if it is slower than
GCC for trivial input. What I see is:

# time sh -c 'for i in $(seq 1 100); do /usr/bin/clang -c test.c; done'
        2.29 real         1.32 user         0.96 sys
# time sh -c 'for i in $(seq 1 1000); do /usr/pkg/bin/clang -c test.c; done'
       26.08 real        13.25 user        12.82 sys
# time sh -c 'for i in $(seq 1 1000); do /usr/pkg/gcc48/bin/gcc -c test.c; done'
       29.69 real        14.84 user        14.84 sys

...but I don't know what's wrong with the package.


Home | Main Index | Thread Index | Old Index