Firefox/Projects/Startup Time Improvements Notes: Difference between revisions

 
(16 intermediate revisions by 4 users not shown)
Line 1: Line 1:
= Emails From Vlad on Startup =
=Notes=
== Emails From Vlad on Startup ==


* Importance of Cold Start
;Importance of Cold Start


<pre>
<pre>
Line 40: Line 41:
</pre>
</pre>


The purge command on Linux, <tt>echo 3>  /proc/sys/vm/drop_caches</tt>, requires root privileges. [ddahl via adw]


* Startup post on dev-apps-firefox
== Startup post on dev-apps-firefox==


<pre>
<pre>
Shortly before our office move, we kicked off an effort to take a hard
Shortly before our office move, we kicked off an effort to take a hard
look at our startup time, to both understand what we all do, and to
look at our startup time, to both understand what we all do, and to
Line 123: Line 121:
     - Vlad  
     - Vlad  
</pre>
</pre>
== Rob Arnold notes on simulated cold startup on Windows==
<pre>
[14:00] <robarnold> for the disk, you open the disk and flush it...
[14:00] <robarnold> for the cache, there's a sysinternals utility
[14:01] <robarnold> taras: see http://technet.microsoft.com/en-us/sysinternals/bb897561.aspx
[14:02] <robarnold> there's also http://twpol.dyndns.org/weblog/2009/07/29/01 which someone on vlad's blog found
[14:05] <robarnold> ok. your results will probably be tainted by the windows feature that predicts file io for a process based on past runs (don't remember the name)
[14:07] <robarnold> ah, I think it's in \Windows\Prefetch (at least it seems to be so on windows 7)
[14:07] <robarnold> note that you might not have access to that folder since the systems, not the administrator, owns it
[14:07] <robarnold> *system
[14:17] <sid0> taras, robarnold: suggest you disable the prefetcher altogether
[14:17] <sid0> HKEY_LOCAL_MACHINE\SYSTEM\CurrentC­ontrolSet\Control\Session Manager\Memory Management\Prefetcher
[14:18] <sid0> set EnablePrefetcher to 0 and (on Vista and above) EnableSuperfetch to 0
[14:18] <sid0> this might also need a reboot + clearing out of windows\prefetch
</pre>
On XP at least the final fragment of the regkey mentioned by sid0 is slightly different.  Not sure whether it's different from Vista/7 or he was just remembering wrong: [adw]
<pre>
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PrefetchParameters
</pre>
(sorry, I remembered wrong. -- sid0)
The default value of the <tt>EnablePrefetcher</tt> key is 3 (on XP at least). [adw]
(it's the same on Vista/7 -- sid0)
=== adw's Windows XP experience ===
The notes above point to three tools for purging disk cache on Windows:
* [http://technet.microsoft.com/en-us/sysinternals/bb897561.aspx CacheSet] from Microsoft
** Uses a system call to request that the working set of the system's cache be cleared.
* [http://twpol.dyndns.org/weblog/2009/07/29/01 purge.exe] from Silver
** This appears to be equivalent to CacheSet.
* [http://chadaustin.me/2009/04/flushing-disk-cache/ flushmem.exe] from Chad Austin
** Allocates memory in 64 KiB chunks until it can't anymore, and then writes to each page, forcing older pages out to the page file.
I noticed no difference between starting Firefox warm and starting it after using both CacheSet and purge.exe.  Whatever they may do, combined with disabled prefetch they are not sufficient to simulate cold startup.
After using flushmem.exe, Firefox starts up in about the same time it takes for it to startup cold, but it ground my system to a halt for nearly ten minutes.
These were Vlad's experiences as well:
<pre>
[12:06pm] dietrich: vlad: what's the recommended way to force cold-start on windows?
[12:08pm] vlad: all the stuff that people suggested doesn't work
[12:08pm] vlad: with cacheset/purge/etc.
[12:08pm] vlad: so I have no idea, other than reboot
[12:09pm] vlad: reboot and turning off all the prefetching
[12:09pm] adw: vlad: is https://wiki.mozilla.org/Firefox/Projects/Startup_Time_Improvements_Notes not correct?
[12:13pm] vlad: -that- sadly is
[12:13pm] vlad: flushmem would work
[12:13pm] vlad: but it's faster to reboot
[12:13pm] vlad: since flushmem causesyour system to grind to a halt for a few minutes, even more if you have lots of memory
</pre>
Quoting a Microsoft [http://tester.poleyland.com/ software tester] on this [http://social.msdn.microsoft.com/forums/en-US/softwaretesting/thread/d4729488-d610-45bc-bea9-4f8e3e59c62d/ MSDN forum thread]:
<blockquote>
This is actually a very complicated thing to do, and to do it correctly, these are some of the things you need to worry about:
* Invalidating the CPU caches
* Invalidating the cache on the storage media
* Invalidating the OS's read cache (note that this is not the same as the write cache which can be flushed with [http://technet.microsoft.com/en-us/sysinternals/bb897438.aspx Sync.exe] via [http://msdn2.microsoft.com/en-us/library/aa364439.aspx FlushFileBuffers])
* Removing items from the OS's KnownDLL cache ([http://blogs.msdn.com/larryosterman/archive/2004/07/19/187752.aspx Larry], [http://support.microsoft.com/kb/164501 KB])
* Removing items from the CLR JIT compilation cache (.NET apps only)
</blockquote>
Confirmed users, Bureaucrats and Sysops emeriti
2,088

edits