5
6

More than 5 years have passed since last update.

[Linux] gcc と clang の速度比較

Posted at

概要

clangが速いらしいといううわさを聞いたので、gccと比較してみた。

手っ取り早くビルドに時間がかかりそうなものがffmpegだったので、それで実験。

clangのインストール

# yum install clang --enablerepo=epel

FFmpegの準備

ffmpeg最新版
$ git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg

configure

共通部分
$ ./configure \
--prefix=/usr/local \
--enable-gpl \
--enable-version3 \
--enable-nonfree \
--enable-static \
--disable-shared \
--disable-doc \
--disable-htmlpages \
--disable-manpages \
--disable-podpages \
--disable-txtpages \
--enable-libfaac \
--enable-libmp3lame \
--enable-libtheora \
--enable-libvorbis \
--enable-libx264 \
--enable-libx265 \
--enable-libvpx \
--enable-fontconfig \
--extra-cflags=-I/usr/local/include \
--extra-ldflags=-L/usr/local/lib \
--enable-memalign-hack

gccでビルド

$ time make -j32

real    1m46.906s
user    18m55.527s
sys     0m54.030s

$ ls -la ffmpeg
-rwxr-xr-x 1 wwwuser wwwuser 17138544 Jan  7 12:41 ffmpeg

clangでビルド

configure--cc=clangを追加する。

clangでのコンパイル
$ time make -j32

real    1m27.455s
user    13m27.972s
sys     0m46.578s

$ ls -la ffmpeg
-rwxr-xr-x 1 wwwuser wwwuser 14959208 Jan  7 12:36 ffmpeg

記事のとおり、速くなってファイルサイズも小さくなった。わーい。

5
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
6