Archive for November 10th, 2009

在上一篇blog里用最简单的方式编译了firefox,今天用PGO方式重新优化编译了一下。 官方的PGO编译文档参考https://developer.mozilla.org/en/Building_with_Profile-Guided_Optimization 首先将.mozconfig修改如下: 其中 ac_add_options –enable-optimize=”-O2 -march=native -mtune=native -pipe -fomit-frame-pointer”, ac_add_options –enable-jemalloc, ac_add_options –enable-strip, ac_add_options –enable-install-strip 这四个选项是优化编译选项。 ac_add_options –enable-profile-guided-optimization 这个选项表示用PGO方式编译,而 mk_add_options PROFILE_GEN_SCRIPT=”sh /home/xmx/run-firefox.sh” 这个选项指定了PGO编译第一遍结束后执行的脚本。 而run-firefox.sh的内容如下: 配置结束后在源码顶层目录执行: 注意执行的是profiledbuild而不是之前简单的build 然后就开第一次编译,等待。。。 第一次编译结束后会自动调用run-firefox.sh脚本,运行刚刚编译完的firefox(第一次编译的时候千万不要运行原来的firefox,以免这里出错)。按照平时的上网习惯看一些网页,然后关掉,第二次编译便自动开始了。第二次编译会以第一次编译后运行产生的profile调优,通常能获得相当不错的性能提升。 第二次编译结束后便和普通编译一样了: 在ff-opt/dist下就已经生成了一个打包好的firefox包,解压到任何地方运行就可以了。

Tuesday, November 10th, 2009 at 19:52 | 1 comment
Categories: Computer
TOP