Closed Bug 1360214 Opened 7 years ago Closed 7 years ago

SanityTest.js is expensive during startup

Categories

(Core :: Graphics, defect)

x86_64
Windows
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Performance Impact high

People

(Reporter: florian, Assigned: milan)

References

(Blocks 1 open bug)

Details

See this profile https://perfht.ml/2qj0y5z where SanityTest.js costs us 144ms (out of 2.2s) during startup before the first browser window is shown.

Can SanityTest.js avoid doing main thread I/O during startup? (the mozilla::Preferences::SavePrefFile call is expensive)

Could some of this run on a different process?
The second savePrefFile call at http://searchfox.org/mozilla-central/rev/3dc6ceb42746ab40f1441e1e659ffb8f62ae78e3/toolkit/components/gfx/SanityTest.js#65 during reportResult costs us 132ms of UI jank in this profile: https://perfht.ml/2p1pMFw (and the first savePrefFile before the first window is shown costs us 128ms of startup time... but I believe that first flush is to ensure the information has reached the disk if we crash while testing gfx stuff. I can't see a justification for the second flush though).
Bug 1361262 has some discussion of SavePrefFile() as well.
See Also: → 1361262
Whiteboard: [qf] → [qf:p1]
Assignee: nobody → milan
Florian, do you have time to build with patches attached to bug 789945 and re-run this test?
Flags: needinfo?(florian)
(In reply to Milan Sreckovic [:milan] from comment #3)
> Florian, do you have time to build with patches attached to bug 789945 and
> re-run this test?

If you give me a try server build, I can profile it next week. I'm not going to try building on the reference hardware.
Flags: needinfo?(florian)
ni? to florian now that try build has been provided (comment 5).
Flags: needinfo?(florian)
Florian: ping?
Probably not worth profiling on that try build at this point, the code has changed enough.  Let me do another build with up to date patches.
This build should be fine for testing: https://treeherder.mozilla.org/#/jobs?repo=try&revision=59aa8545e836cbd171fe830825a7d9b199d6c6cb

A preference "preferences.allow.omt-write", true by default, can be set to false to force back the original behaviour.  With the default true, we should have async/off main thread preference saves in majority of the cases.
Here is a profile of the first startup (so running SanityTest.js) of the try build from comment 9: https://perfht.ml/2qI7Osr

Unfortunately without symbols the profile isn't very useful to look at non-JS code.
Flags: needinfo?(florian)
Patches that landed in bug 789945 should take care of this.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Performance Impact: --- → P1
Whiteboard: [qf:p1]
You need to log in before you can comment on or make changes to this bug.