Why Clang
Mark Felder
feld at feld.me
Mon Jun 18 15:35:06 UTC 2012
On Sun, 17 Jun 2012 15:13:05 -0500, Wojciech Puchar
<wojtek at wojtek.tensor.gdynia.pl> wrote:
>>
>> Clang is consistently faster at compiling than GCC and it is very clean
>> and modular -- not bloated.
>
> -r-xr-xr-x 3 root wheel 37025016 12 cze 21:46 /usr/bin/clang
>
> well..
>
# ls -la /usr/local/bin/clang
-rwxr-xr-x 1 root wheel 14360344 Jun 18 09:57 /usr/local/bin/clang
# ls -la /usr/bin/clang
-r-xr-xr-x 3 root wheel 32578976 Jun 18 09:12 /usr/bin/clang
Looks like FreeBSD's current base build includes debugging/symbols even in
-RELEASE. I'm sure there's a reason for this.
# ls -la /usr/bin/g++
-r-xr-xr-x 3 root wheel 199208 May 22 14:26 /usr/bin/g++
# ls -la /usr/bin/clang++
-r-xr-xr-x 3 root wheel 32578976 Jun 18 09:12 /usr/bin/clang++
# ls -la /usr/local/bin/clang++
lrwxr-xr-x 1 root wheel 5 Jun 18 09:57 /usr/local/bin/clang++ -> clang
FreeBSD and Ports installation method of CLANG differs further here
# stat -x /usr/bin/clang
File: "/usr/bin/clang"
Size: 32578976 FileType: Regular File
Mode: (0555/-r-xr-xr-x) Uid: ( 0/ root) Gid: ( 0/
wheel)
Device: 85,3144417526 Inode: 23483 Links: 3
Access: Tue May 22 14:27:20 2012
Modify: Mon Jun 18 09:12:53 2012
Change: Mon Jun 18 09:12:53 2012
# stat -x /usr/bin/clang++
File: "/usr/bin/clang++"
Size: 32578976 FileType: Regular File
Mode: (0555/-r-xr-xr-x) Uid: ( 0/ root) Gid: ( 0/
wheel)
Device: 85,3144417526 Inode: 23483 Links: 3
Access: Tue May 22 14:27:20 2012
Modify: Mon Jun 18 09:12:53 2012
Change: Mon Jun 18 09:12:53 2012
Yup, so Ports symlinks (without full path -- this should be fixed) and
FreeBSD BASE uses a hardlink.
# ldd /usr/local/bin/clang
/usr/local/bin/clang:
libLLVM-3.0.so => /usr/local/lib/libLLVM-3.0.so (0x80155e000)
libthr.so.3 => /lib/libthr.so.3 (0x802ea0000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x8030c3000)
libm.so.5 => /lib/libm.so.5 (0x8033d3000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x8035f4000)
libc.so.7 => /lib/libc.so.7 (0x803801000)
# ldd /usr/bin/clang
/usr/bin/clang:
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x80269e000)
libm.so.5 => /lib/libm.so.5 (0x8029ae000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x802bcf000)
libc.so.7 => /lib/libc.so.7 (0x802ddc000)
# ls -la /usr/local/lib/libLLVM-3.0.so
-rwxr-xr-x 1 root wheel 27543632 Jun 18 09:53
/usr/local/lib/libLLVM-3.0.so
# ls -la /lib/libthr.so.3
-r--r--r-- 1 root wheel 101712 May 22 14:26 /lib/libthr.so.3
So from what I can tell LLVM is the monster here, not Clang (which is also
of significant size, but it's 2012 so Clang isn't *that* big)
None of this seems very relevant, but here's also lines of code via
sloccount:
# sloccount clang-3.0.src/
Totals grouped by language (dominant language first):
cpp: 390865 (82.34%)
ansic: 50466 (10.63%)
objc: 24970 (5.26%)
python: 5874 (1.24%)
perl: 1951 (0.41%)
lisp: 379 (0.08%)
pascal: 123 (0.03%)
sh: 86 (0.02%)
Total Physical Source Lines of Code (SLOC) = 474,714
# sloccount llvm-3.0.src/
Totals grouped by language (dominant language first):
cpp: 468021 (75.80%)
asm: 109345 (17.71%)
ansic: 13782 (2.23%)
sh: 12848 (2.08%)
ml: 4716 (0.76%)
python: 4351 (0.70%)
perl: 2093 (0.34%)
pascal: 1566 (0.25%)
exp: 389 (0.06%)
lisp: 187 (0.03%)
csh: 117 (0.02%)
Total Physical Source Lines of Code (SLOC) = 617,415
# sloccount gcc-4.2.1/
Totals grouped by language (dominant language first):
ansic: 1306440 (43.95%)
ada: 584415 (19.66%)
java: 583316 (19.62%)
cpp: 346603 (11.66%)
asm: 37548 (1.26%)
f90: 36055 (1.21%)
sh: 30089 (1.01%)
yacc: 15006 (0.50%)
exp: 11218 (0.38%)
fortran: 7139 (0.24%)
objc: 6921 (0.23%)
perl: 3038 (0.10%)
pascal: 1194 (0.04%)
cs: 879 (0.03%)
lex: 857 (0.03%)
awk: 732 (0.02%)
python: 582 (0.02%)
tcl: 271 (0.01%)
haskell: 93 (0.00%)
lisp: 59 (0.00%)
Total Physical Source Lines of Code (SLOC) = 2,972,455
So GCC 4.2.1 is nearly 3 million lines of code, but CLANG+LLVM is sitting
at 1.1 million lines of code.
Are you sure CLANG is the bloated project?
More information about the freebsd-questions
mailing list