There are several refactorings, some more aggressive than others, that may be undertaken to reduce jank in Session Restore data collection. To determine how aggressive we should be, we should first gather Telemetry data on session jank.
We may proceed as follows: - whenever data collection starts, launch a |requestAnimationFrame|-based loop; - record the longest interval between two steps of the loop; - stop the loop once data collection is complete; - add this interval to a telemetry histogram. Vlad, what do you think of this approach? Note that the pattern may be factored to a JankUtils.jsm.
For posterity and to clear the need-info flag :P (3:19:27 AM) Yoric: What is the best way of programmatically measuring jank from jsm code? (3:19:59 AM) Yoric: I am thinking of adding a requestAnimationFrame or MozAfterPaint listener. Is there a better solution? (3:21:34 AM) vladan: Yoric: what exactly are you trying to do? (3:21:48 AM) vladan: is this the serialization of JSON in chunks? (3:21:55 AM) Yoric: No, Session Restore. (3:22:05 AM) Yoric: (although it could serve for JSON serialization, eventually) (3:22:27 AM) Yoric: I want to be able to get Telemetry information on the jank during serialization. (3:22:51 AM) Yoric: Before I hack too much, I want to be able to measure improvements. (3:23:46 AM) Yoric: It might be that, just by collecting tabs separately, we already improve enough that I don't need to do my deep hack-through-history-serialization-of-a-single-tab. (3:23:54 AM) vladan: right (3:26:03 AM) vladan: i guess you'd want to know amount of time the main event loop spends idle during some interval of time? any such measure of browser jank is going to be noisy, even in local testing.. why not just have a histogram of how long it takes you to collect session state data (either that one giant event or each of the per-tab events) (3:26:53 AM) vladan: there's also the EVENTLOOP_UI_LAG_EXP histogram which sorta-kinda tracks user-visible jank, but you don't really want that.. however if you end up implementing main-event-loop-idleness measure you'd likely want to pattern it after that histogram (3:27:03 AM) Yoric: Mmmh... (3:27:28 AM) Yoric: I guess I could have a histogram MAX_DURATION_OF_ELEMENTARY_SERIALIZATION_OPERATION_DURING_SESSION_RESTORE_COLLECTION or something such. (3:27:34 AM) Yoric: And have it change semantics during refactoring. (3:28:04 AM) Yoric: (initially the full serialization operation, then each tab serialization once they are separated) (3:28:11 AM) vladan: i suggested a histogram cause i'd also be curious to know the sum time spent in elementary operations (3:28:27 AM) Yoric: Well, we could have both. (3:28:35 AM) vladan: yes, true, both are ideal
Attaching a trivial patch to measure said jank. By itself, this patch is useless, but it will give us a point of comparison for progressive refactorings of session restore data collection.
Assignee: nobody → dteller
Attachment #709196 - Flags: review?(ttaubert)
Comment on attachment 709196 [details] [diff] [review] Initial measure of Session Restore Collection jank Review of attachment 709196 [details] [diff] [review]: ----------------------------------------------------------------- I really like having something we can compare our efforts to. Thanks!
Attachment #709196 - Flags: review?(ttaubert) → review+
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 21
You need to log in before you can comment on or make changes to this bug.