Closed Bug 724177 Opened 10 years ago Closed 10 years ago
30-50ms (5%) Firefox startup speed optimization on Windows in ns
Local File Win
I was profiling nsLocalFileWin and noticed a slowdown on Windows startup. About 30-60ms was spent copying a single file on startup. The file copy happens on the *main thread*. The file that is copied is sessionStore.js to sessionstore.bak. The file is <1KB on my profile and tests, but I've seen this file up to 400KB on my other unused profiles. The slowdown happens after mozilla::StartupTimeline::FIRST_PAINT but before StartupTimeline::SESSION_RESTORED. The slowdown was completely removed and accounted for 30ms-60ms of startup time. Bug 545650 introduced the no buffering flag when copying files to solve a bug for network drives. This landed in March 2011. On startup, we use the flag for copying sessionstore to a backup location, and this location is not on a network drive. With the flag the copy takes 30-60ms. Without the flag the copy takes less than 1ms. I've noticed this file copy operation using xperf in the past, but this optimization was done using my local simple profiler independent of that. I confirmed these findings using the about:startup extension. The 20 run average for session restored is 1016.27 vs 963.14 (53.13ms savings) Please see the attached screenshot for a breakdown.
See also Bug 716174.
Thanks for the heads up khuey, I put some info in that bug about the post effects after this lands.
jimm: I tried the remote drive detection code with both mapped drive paths and UNC paths by the way.
With the browser open for only a couple minutes by the way there were 5 other copy calls, so this should save time in general as well.
Brian see 716174.
Depends on: 716174
Taras see Comment 2 :P
Comment on attachment 594370 [details] [diff] [review] Patch v1. Review of attachment 594370 [details] [diff] [review]: ----------------------------------------------------------------- Nice little bit of optimization - thanks!
Attachment #594370 - Flags: review?(jmathies) → review+
Thanks for the review! Pushed to try: https://tbpl.mozilla.org/?tree=Try&rev=6909a52f8357
Target Milestone: --- → mozilla13
Status: NEW → RESOLVED
Closed: 10 years ago
Hardware: x86_64 → All
Resolution: --- → FIXED
Version: unspecified → Trunk
You need to log in before you can comment on or make changes to this bug.