{"id":1607,"date":"2011-02-01T17:45:23","date_gmt":"2011-02-01T16:45:23","guid":{"rendered":"http:\/\/glandium.org\/blog\/?p=1607"},"modified":"2011-02-01T19:57:23","modified_gmt":"2011-02-01T18:57:23","slug":"backwards-io-vs-forward-io","status":"publish","type":"post","link":"https:\/\/glandium.org\/blog\/?p=1607","title":{"rendered":"Backwards I\/O vs. Forward I\/O"},"content":{"rendered":"<p>I <a href=\"\/blog\/?p=1177#static-initializers\">mentioned it in the past<\/a>, and <a href=\"http:\/\/blog.mozilla.com\/tglek\/2010\/05\/27\/startup-backward-constructors\/\">so did Taras<\/a>, static initializers are currently called in reverse order of their location in a library. This can be seen, for example, in the various <a href=\"\/blog\/?p=1296\">graphs I gathered about startup I\/O<\/a>. I <a href=\"\/blog\/?p=1177#static-initializers\">also mentioned<\/a> that I had written a small tool reversing these static initializers in ELF binaries. I however hadn't checked the impact on startup. Until today.<\/p>\n<p>The testing setup still remains the same as in <a href=\"\/blog\/?p=1296\">previous<\/a> <a href=\"\/blog\/?p=1269\">posts<\/a> and the results are still the average and 95% confidence interval for 50 startups of an unmodified Firefox 4.0b8 build.<\/p>\n<table class=\"table\">\n<tr>\n<th><\/th>\n<th>With backwards static initializers (ms)<\/th>\n<th>With forward static initializers (ms)<\/th>\n<th>Difference<\/th>\n<\/tr>\n<tr>\n<th>x86<\/th>\n<td>3,228.76 \u00c2\u00b1 0.57%<\/td>\n<td>2,888.44 \u00c2\u00b1 0.55%<\/td>\n<td>340.32 (10.5%)<\/td>\n<\/tr>\n<tr>\n<th>x86-64<\/th>\n<td>3,382.0 \u00c2\u00b1 0.51%<\/td>\n<td>3,102.46 \u00c2\u00b1 0.51%<\/td>\n<td>279.54 (8.26%)<\/td>\n<\/tr>\n<\/table>\n<p>I'm actually surprised by the result. I did expect that forward reads would be slightly faster than backwards reads, I wasn't expecting that much difference.<\/p>\n<p>I guess I should work on <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=606137\">bug 606137<\/a>, then. Combined with <a href=\"\/blog\/?p=1177#packing-relocations\">relocations packing<\/a> that <a href=\"http:\/\/hg.mozilla.org\/mozilla-central\/pushloghtml?changeset=9a6de1e28d4b\">landed after beta 10<\/a>, it should have a nice startup impact.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I mentioned it in the past, and so did Taras, static initializers are currently called in reverse order of their location in a library. This can be seen, for example, in the various graphs I gathered about startup I\/O. I also mentioned that I had written a small tool reversing these static initializers in ELF [&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-1607","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\/1607","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=1607"}],"version-history":[{"count":15,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1607\/revisions"}],"predecessor-version":[{"id":1634,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1607\/revisions\/1634"}],"wp:attachment":[{"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1607"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1607"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1607"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}