{"id":2145,"date":"2011-08-04T14:50:50","date_gmt":"2011-08-04T12:50:50","guid":{"rendered":"http:\/\/glandium.org\/blog\/?p=2145"},"modified":"2011-08-04T14:57:36","modified_gmt":"2011-08-04T12:57:36","slug":"no-wonders-with-pgo-on-android","status":"publish","type":"post","link":"https:\/\/glandium.org\/blog\/?p=2145","title":{"rendered":"No wonders with PGO on Android"},"content":{"rendered":"<p>I got Profile Guided Optimization (a.k.a. Feedback Directed Optimization) to work for Android builds, using <a href=\"\/blog\/?p=2146\">GCC 4.6.1 and Gold 2.21.53<\/a>.<\/p>\n<p>Getting such a build is not difficult, just a bit time consuming.<\/p>\n<ul>\n<li>Apply the <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=632954\">patches from bug 632954<\/a><\/li>\n<li>Get an instrumented build with the following command:<br \/>\n<blockquote><p><code>$ make -f client.mk MOZ_PROFILE_GENERATE=1 MOZ_PROFILE_BASE=\/sdcard\/mozilla-pgo<\/code><\/p><\/blockquote>\n<\/li>\n<li>Create a Fennec Android package:<br \/>\n<blockquote><p><code>$ make -C $objdir package<\/code><\/p><\/blockquote>\n<p>If you get an elfhack error during this phase, make sure to update your tree, the <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=674888\">corresponding elfhack bug<\/a> has been fixed.<\/li>\n<li>Install the package on your device:<br \/>\n<blockquote><p><code>$ adb install -r $objdir\/dist\/fennec-8.0a1.en-US.android-arm.apk<\/code><\/p><\/blockquote>\n<\/li>\n<li>Open Fennec on your device, and do some things in your browser, so that execution data is collected. For my last build, I installed the <a href=\"http:\/\/zippityserver.appspot.com\/addon\">Zippity Test Harness add-on<\/a>, and ran V8, Sunspider and PageLoad tests<\/li>\n<li>Collect the execution data:<br \/>\n<blockquote><p><code>$ adb pull \/sdcard\/mozilla-pgo \/<\/code><\/p><\/blockquote>\n<\/li>\n<li>Clean-up the build tree:<br \/>\n<blockquote><p><code>$ make -f client.mk clean<\/code><\/p><\/blockquote>\n<\/li>\n<li>Build using the execution data:<br \/>\n<blockquote><p><code>$ make -f client.mk MOZ_PROFILE_USE=1<\/code><\/p><\/blockquote>\n<\/li>\n<li>Create the final Fennec Android package, install and profit:<br \/>\n<blockquote><p><code>$ make -C $objdir package<br \/>\n$ adb install -r $objdir\/dist\/fennec-8.0a1.en-US.android-arm.apk<\/code><\/p><\/blockquote>\n<\/li>\n<\/ul>\n<p>As the title indicates, though, this actually leads to some disappointment. On my Nexus S, the resulting build is actually slightly slower on Sunspider than the corresponding nightly. It is however much faster on V8 (down to around 1200 from around 1800), but... is just as fast as a non PGO\/FDO build with GCC 4.6. Even sadder, the non PGO\/FDO build with GCC 4.6 is faster on Sunspider than the PGO\/FDO build, and on-par with the GCC 4.4-built nightly.<\/p>\n<p>So, my experiments suggest that switching to GCC 4.6 would give us some nice speed-ups, but enabling PGO\/FDO wouldn't add to that.<\/p>\n<p>If you want to test and compare my builds on different devices, please go ahead, with the following builds:<\/p>\n<ul>\n<li><a href=\"http:\/\/people.mozilla.org\/~mhommey\/pgo\/fennec-8.0a1.en-US.android-arm.1dddaeb1366b.nightly.apk\">Yesterday's nightly build<\/a>, built with GCC 4.4 (13,522,584 bytes)<\/li>\n<li><a href=\"http:\/\/people.mozilla.org\/~mhommey\/pgo\/fennec-8.0a1.en-US.android-arm.1dddaeb1366b.gcc4.6.apk\">Build of the same commit, with GCC 4.6<\/a> (12,984,560 bytes)<\/li>\n<li><a href=\"http:\/\/people.mozilla.org\/~mhommey\/pgo\/fennec-8.0a1.en-US.android-arm.1dddaeb1366b.pgo.apk\">Build of the same commit, with GCC 4.6 and PGO\/FDO enabled<\/a> (13,992,139 bytes)<\/li>\n<\/ul>\n<p>The former will install as \"Nightly\", while the two others will install as \"Fennec\".<\/p>\n<p>The sizes are also interesting: while the PGO build is bigger than the Nightly build, the plain GCC 4.6 build is smaller.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I got Profile Guided Optimization (a.k.a. Feedback Directed Optimization) to work for Android builds, using GCC 4.6.1 and Gold 2.21.53. Getting such a build is not difficult, just a bit time consuming. Apply the patches from bug 632954 Get an instrumented build with the following command: $ make -f client.mk MOZ_PROFILE_GENERATE=1 MOZ_PROFILE_BASE=\/sdcard\/mozilla-pgo Create a Fennec [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[23],"class_list":["post-2145","post","type-post","status-publish","format-standard","hentry","category-planet-mozilla","tag-en"],"_links":{"self":[{"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2145","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2145"}],"version-history":[{"count":12,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2145\/revisions"}],"predecessor-version":[{"id":2190,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2145\/revisions\/2190"}],"wp:attachment":[{"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2145"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2145"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2145"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}