#215 Switching a new event to Duration is slow: the tabs swap two modal dialogs
–
- github
- github/openchronology/timeline-app
- github/openchronology/timeline-app#215
- issue
- state:closed
Since #209 (PR #211), choosing the **Duration** tab of a new event is about 2–3× slower than the old **+ Duration**. In CI's browser UI benchmark (`new-duration`, 1,000 moments) it went from about 19 ms to 43–58 ms unthrottled, and from about 50 ms to 105–153 ms at 4× CPU throttling. PR #214's run reached 153 ms, over the 150 ms budget, and failed the gate. ## Why The tabs switch between two ` ` elements: they close the moment dialog and `showModal()` the duration dialog. A Chrome CPU profile of the switch (1,000 moments, 4× throttling) shows the cost per switch: - about 58 ms in `showModal` and 57 ms in `close`: changing which dialog is modal makes the browser recompute styles for the whole page; - a redraw of the timeline, which the moment dialog's close handler requests. The old + Duration paid for one `showModal`. Switching tabs pays for a `close` and a `showModal`. ## Fix Make the event dialog one ` `, as #209 first proposed. The duration form becomes a panel in it beside the moment form. Switching tabs shows one panel and hides the other, so nothing modal changes. A duration opened from a moment's details currently opens on top of it; closing it returns to the moment. With one dialog, the duration panel replaces the moment panel, and closing the duration (×, Cancel, Save, Escape or a backdrop click) shows the moment panel again. https://github.com/openchronology/timeline-app/issues/215
Related
- #209 Vocabulary: an event is a moment or a duration; one + Event dialog with Moment and Duration tabs
- #211 An event is a moment or a duration: one + Event dialog with Moment and Duration tabs (#209)
- #214 Remove the redundant Exact rational bounds and offline Licenses sections (#213)
- #216 One event dialog: the duration form is a panel beside the moment's (#215)
- One event dialog: the duration form is a panel beside the moment's (#215)
- Merge pull request #216 from openchronology/fix/one-event-dialog
Open #215 Switching a new event to Duration is slow: the tabs swap two modal dialogs in the timeline