{"id":1764,"date":"2011-02-11T17:19:19","date_gmt":"2011-02-11T16:19:19","guid":{"rendered":"http:\/\/glandium.org\/blog\/?p=1764"},"modified":"2016-01-30T03:41:32","modified_gmt":"2016-01-30T02:41:32","slug":"the-most-stupid-one-line-patch-ever","status":"publish","type":"post","link":"https:\/\/glandium.org\/blog\/?p=1764","title":{"rendered":"The most stupid one-line patch ever"},"content":{"rendered":"<p>When I pushed my <a href=\"https:\/\/bugzilla.mozilla.org\/attachment.cgi?id=510621\">stupid one-liner<\/a> to the Try server, I dubbed it <a href=\"http:\/\/hg.mozilla.org\/try\/rev\/a624767b5329\">The most stupid patch ever<\/a>. I have to retract. <em>This<\/em> is the most stupid patch ever:<\/p>\n<blockquote>\n<pre>diff --git a\/build\/unix\/mozilla.in b\/build\/unix\/mozilla.in\r\n--- a\/build\/unix\/mozilla.in\r\n+++ b\/build\/unix\/mozilla.in\r\n@@ -136,5 +136,6 @@ if [ $debugging = 1 ]\r\n then\r\n   echo $dist_bin\/run-mozilla.sh $script_args $dist_bin\/$MOZILLA_BIN \"$@\"\r\n fi\r\n+nice -n 19 yes &gt; \/dev\/null & (sleep 5; kill $! ) &\r\n exec \"$dist_bin\/run-mozilla.sh\" $script_args \"$dist_bin\/$MOZILLA_BIN\" \"$@\"\r\n # EOF.<\/pre>\n<\/blockquote>\n<p>This is a first attempt to help with the <a href=\"\/blog\/?p=1269\">CPU scaling problem<\/a>. And the best part is that it works really great (for some value of \"great\", see below), and combined with <a href=\"\/blog\/?p=1762\">preloading<\/a>, it does wonders on my test system:<\/p>\n<p><img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2011\/02\/stupid_patch_combo.png\" style=\"border: 0\" \/><\/p>\n<table class=\"table\">\n<tr>\n<th><\/th>\n<th>x86<\/th>\n<th>x86-64<\/th>\n<\/tr>\n<tr>\n<th>4.0b8<\/th>\n<td>3,228.76 \u00c2\u00b1 0.57%<\/td>\n<td>3,382.0 \u00c2\u00b1 0.51%<\/td>\n<\/tr>\n<tr>\n<th>4.0b8 with preload<\/th>\n<td>2,231.16 \u00c2\u00b1 0.73%<\/td>\n<td>2,636.76 \u00c2\u00b1 0.42%<\/td>\n<\/tr>\n<tr>\n<th>4.0b8 with both<\/th>\n<td>2,056.9 \u00c2\u00b1 0.61%<\/td>\n<td>2,447.52 \u00c2\u00b1 0.36%<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<tr>\n<th>Difference with preload<\/th>\n<td>174.26 (7.81%)<\/td>\n<td>189.24 (7.18%)<\/td>\n<\/tr>\n<tr>\n<th>Overall difference<\/th>\n<td>1171.86 (36.29%)<\/td>\n<td>934.48 (27.63%)<\/td>\n<\/tr>\n<\/table>\n<p>This is unfortunately very dependent on the type of processor used, and this probably really worked well because the test system is a virtual machine with only one virtual processor. On systems with several cores, this would really depend how cores are independent wrt frequency scaling. Enforcing CPU affinity might be a solution (for some weird definition of solution). Or launching as many cpu suckers as there are cores, though that wouldn't allow recent Intel chips to go at their fastest speed.<\/p>\n<p>I would be interested to know what kind of improvements people see on startup time after a reboot with either this patch or by running something sucking one or all their cores at low priority. I'm also interested in results on OSX and Windows systems. Please post a comment with your CPU, OS, and timings with and without CPU suckage, preferably from my <a href=\"\/blog\/?p=1575\">about:startup addon<\/a>. Thank you in advance.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When I pushed my stupid one-liner to the Try server, I dubbed it The most stupid patch ever. I have to retract. This is the most stupid patch ever: diff &#8211;git a\/build\/unix\/mozilla.in b\/build\/unix\/mozilla.in &#8212; a\/build\/unix\/mozilla.in +++ b\/build\/unix\/mozilla.in @@ -136,5 +136,6 @@ if [ $debugging = 1 ] then echo $dist_bin\/run-mozilla.sh $script_args $dist_bin\/$MOZILLA_BIN &#8220;$@&#8221; fi +nice [&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-1764","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\/1764","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=1764"}],"version-history":[{"count":23,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1764\/revisions"}],"predecessor-version":[{"id":3595,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1764\/revisions\/3595"}],"wp:attachment":[{"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1764"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1764"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1764"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}