{"id":752,"date":"2011-05-20T13:03:21","date_gmt":"2011-05-20T02:03:21","guid":{"rendered":"http:\/\/blog.mozilla.org\/nnethercote\/?p=752"},"modified":"2011-05-20T13:04:45","modified_gmt":"2011-05-20T02:04:45","slug":"working-on-the-browser-sucks","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/nnethercote\/2011\/05\/20\/working-on-the-browser-sucks\/","title":{"rendered":"Working on the browser sucks"},"content":{"rendered":"<p>I&#8217;ve joked before that I hoped to never work on anything in Firefox that requires me to build the browser regularly.\u00a0 That probably sounds weird unless you are a member of the JavaScript team, because it&#8217;s possible to do close to 100% of SpiderMonkey development just building the JS shell.<\/p>\n<p>Working on the JS shell is great.\u00a0 On my 2.5 year old Linux box it takes maybe 1 minute to build from scratch, rebuilds are almost instantaneous, the regression tests take a few minutes, shell start-up is instantaneous, you rarely have to do try server runs, tools like GDB and Valgrind are easy to run, and landing patches on the TraceMonkey repo is low-stress because breakage doesn&#8217;t affect too many people.<\/p>\n<p>In comparison, working on the browser sucks.\u00a0 Builds from scratch take 25 minutes, zero-change rebuilds take 1.5 minutes, single-change rebuilds take 3 or 4 minutes, the linking stage grinds my machine to a halt, cold starts take up to 20 seconds or more (warm starts are <em>much<\/em> better), the test suites are gargantuan, every change requires a try server run, tools like GDB and Valgrind require jumping though hoops (<code>--disable-jemalloc<\/code>, anyone?), and landing patches on mozilla-central is stressful.<\/p>\n<p>Thanks to my recent about:memory work, I&#8217;ve had to experience this pain first-hand.\u00a0 It&#8217;s awful.\u00a0 Debugging experiments that would take 20 seconds in the shell take 5 minutes in the browser. I avoid &#8216;hg up&#8217; as much as possible due to the slow rebuilds it usually entails.\u00a0 How do all you non-JS people deal with it?\u00a0 Maybe you just get used to it&#8230; but I figure there have to be some tips and tricks I&#8217;m not aware of.<\/p>\n<p>(Nb: Why are rebuilds so slow?\u00a0 Because configure is invoked every time?\u00a0 Imprecise dependencies in makefiles?\u00a0 Too much use of recursive make?\u00a0 <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=629668\">Bug 629668<\/a>? Why do Fennec rebuilds seem to be slower than Firefox rebuilds?)<\/p>\n<p>Kyle Huey told me how you can get away with rebuilding only parts of the browser.\u00a0 Eg. if I only modify code under xpcom\/, I can just do <code>make -C &lt;build&gt;\/xpcom &amp;&amp; make -C &lt;build&gt;\/toolkit\/library<\/code> and this reduces the rebuild time a bit.\u00a0 The down-side is that when I screw it up, eg. by forgetting to rebuild a directoy that I changed, it creates Frankenbuilds, and realizing what I&#8217;ve done can end up taking a lot more time than I saved.<\/p>\n<p>Another trick I worked out:\u00a0 implement things in JavaScript.\u00a0  Seriously!\u00a0 While doing my about:memory revamp I originally had a big  chunk of the work done on the C++ side.\u00a0 I quickly realized that if I  did most of it on the JavaScript side I could see the effect of most changes by  simply copying aboutMemory.js from my source dir to my build dir and  then reloading the page.\u00a0 Much better than re-building and re-starting.<\/p>\n<p>What else can I do?\u00a0 Get a faster machine is the obvious option, I guess.\u00a0 More cores would help, though linking would still be a bottleneck.\u00a0 Do SSDs make a big difference?<\/p>\n<p>Also, there&#8217;s talk of using more project branches and introducing mozilla-staging.\u00a0 That would avoid the stress of landing on mozilla-central, but that&#8217;s really the smallest part of what I&#8217;m complaining about.<\/p>\n<p>Any and all suggestions are welcome!\u00a0 Please, I&#8217;m begging you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve joked before that I hoped to never work on anything in Firefox that requires me to build the browser regularly.\u00a0 That probably sounds weird unless you are a member of the JavaScript team, because it&#8217;s possible to do close to 100% of SpiderMonkey development just building the JS shell. Working on the JS shell [&hellip;]<\/p>\n","protected":false},"author":139,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30,649],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/posts\/752"}],"collection":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/users\/139"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/comments?post=752"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/posts\/752\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/media?parent=752"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/categories?post=752"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/tags?post=752"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}