カテゴリー
Emacs Mac

gcc と clang

MacBook Pro を買い替え、 CPU が強化されたので楽しくなっていろいろ遊んでいます。で、 twitter を眺めていたら llvm なんて単語が並んでいて、ふと llvm-gcc と Clang ではどんな違いがあるんだろう、と思って Emacs 23 + inline patch で遊んでみました。 inline patch を当てた Emacs 23 は Clang ではビルドできないのでこんなパッチをあてる必要がある(意味はわからんがエラーは回避できてる)みたいですが、その状態で実験です。
といっても本格的に Clang を使うのは面倒っぽい気がするので CC=gcc , CC=clang としてそれぞれ bootstrap するだけ、ですけど。


goro@sara:~/work/emacs-23.3-gcc$ time (CC=gcc ./configure --with-ns --without-x;make bootstrap)
( CC=gcc ./configure --with-ns --without-x; make bootstrap; ) 359.48s user 35.92s system 96% cpu 6:49.55 total

goro@sara:~/work/emacs-23.3-gcc$ time (CC=gcc ./configure --with-ns --without-x;make -j8 bootstrap)
( CC=gcc ./configure --with-ns --without-x; make -j8 bootstrap; ) 637.43s user 52.41s system 567% cpu 2:01.61 total

goro@sara:~/work/emacs-23.3-clang$ time (CC=clang ./configure --with-ns --without-x;make bootstrap)
( CC=clang ./configure --with-ns --without-x; make bootstrap; ) 344.44s user 34.30s system 96% cpu 6:32.90 total

goro@sara:~/work/emacs-23.3-clang$ time (CC=clang ./configure --with-ns --without-x;make -j8 bootstrap)
( CC=clang ./configure --with-ns --without-x; make -j8 bootstrap; ) 634.69s user 51.22s system 580% cpu 1:58.15 total

結論:並列ビルドすげー(笑)。ということで gcc よりも clang のほうが若干速いようですが、 Emacs であっても誤差でした。出来上がった Emacs.app について体感速度に違いはありません(あったら bootstrap でもっと劇的な差がでるだろう)ので敢えて clang を使う意味は…エラーメッセージがわかりやすいくらいかな?

コメントを残す