Posted in Uncategorized on September 14th, 2010 15 Comments »
Opening files is relatively expensive. There is a small syscall overhead and a higher overhead of fetching data from disk. Depending on physical data layout and disk type, this can leave modern CPUs twiddling their thumbs for a long time while the disk skips around fetching all of the different file pieces. Optimization #1: Fewer [...]
Posted in Uncategorized on September 9th, 2010 8 Comments »
To fight fragmentation it is best to tell the OS to allocate a continuous chunk of space for your file. With specialized APIs, the OS can do this without performing any IO (not counting metadata). I am adding support for this as part of bug 592520. Linux features posix_fadvise for preallocating files. Windows’s SetEndOfFile achieves [...]
Posted in Uncategorized on September 7th, 2010 4 Comments »
Thanks for all of those who commented on previous post on fragmentation. My first fragmentation fix has landed. In current nightlies and future releases the main Firefox databases will grow more aggressively to avoid fragmentation. This should translate into better history/awesomebar/cookie performance for our most dedicated users. Unfortunately fixing existing profiles is hard from within [...]
Posted in Uncategorized on July 14th, 2010 1 Comment »
I try to blog about interesting things I encounter while solving various issues in Mozilla. Some things are less bloggable than others. If this blog don’t fulfill your startup + static analysis needs you can follow my status updates and twitter. For now here is a summary of various half-baked/inprogress work: I worked on upgrading [...]
Posted in Uncategorized on May 24th, 2010 4 Comments »
I have been able to get precise filed-backed page fault logging(systemtap on Linux, xperf on Windows) for a while. It is incredibly useful to see exactly how Firefox is being loaded from disk. From there one I deduce what is causing the IO, try to make improvements and measure if I accomplished anything. Unfortunately, a [...]
Posted in Uncategorized on April 20th, 2010 No Comments »
I landed the mozilla::services bug around the same time as Gavin announced the Services.jsm equivalent. Services.jsm came a pleasant surprise to me, it’s nice to have API symmetry. mozilla::services namespace provides a fast C++ way to refer to common services. This replaces a myriad layers of indirection that happened in the XPCOM GetService() call. Too [...]
Posted in startup, Uncategorized on April 12th, 2010 13 Comments »
Magic of GCC PGO On Friday I finally got gold to produce a prelinkable static binary(bug). I also got around to trying out GCC profile-guided-optimization with the debloatifying -freorder-blocks-and-partition option. This option breaks up every profiled function into cold and hot “functions”. It then lumps all of the hot functions together. PGO performance is amazingly [...]
Posted in Uncategorized on April 7th, 2010 7 Comments »
Most program binaries are laid out with little to no regard to how programs get loaded from disk. This disconnect between compile-time and runtime behaviour of binaries imposes a significant performance penalty to on large applications such as browsers, office suites, etc. It is incredibly difficult to observe both the cause (ie calling a random [...]
Posted in Uncategorized on April 5th, 2010 10 Comments »
As I explained before, loading binaries from disk sucks. Aside from switching glibc to use madvise/fadvise, what can application developers do to minimize this suckyness? I am going to start with numbers to give an idea of the magnitudes involved here. I’m still using my 1.8ghz core2duo laptop with a 7200 200GB harddrive. Time(ms) # [...]
Posted in Uncategorized on March 31st, 2010 2 Comments »
The fastest review I ever got was when I deleted a bunch of code from libjar. It was so riddled crud it was next to impossible to modify the code. That was a mere 24KB patch produced manually. Ehren just put my personal records to shame with a 94KB patch that got r+ed at breakneck [...]