Ref T8394, Attempt to optimize ghost generating code.
Details
- Reviewers
epriestley - Group Reviewers
Blessed Reviewers - Maniphest Tasks
- T8394: Calendar list view should smartly limit the number of total displayed events to 1000.
- Commits
- Restricted Diffusion Commit
rP55c73b20ca8e: Attempt to optimize ghost generating code.
Open Upcoming, cancelled only, list view query. Should not hang.
Diff Detail
- Repository
- rP Phabricator
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
src/applications/calendar/query/PhabricatorCalendarEventQuery.php | ||
---|---|---|
112–113 | These could be initialized later down now, which might make the code easier to follow. | |
194 | This isn't quite right:
| |
196 | 1000 should be $this->getRawResultLimit() | |
196 | Specifically, I'd expect the code to be something like: if (count($events) > $limit) { $events = msort($events, 'getDateFrom'); $events = array_slice($events, 0, $limit, true); $enforced_end = last($events)->getDateFrom(); } See T8394#118074 for discussion. | |
237–244 | Unused. | |
src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php | ||
464–470 ↗ | (On Diff #31741) | I think we should retain this code, and that it's desirable to show 100 results instead of 1000 in the list view. Users are rarely interested in 1,000 results, showing 100 is consistent with all other applications, and 1,000 results will always be slower to generate than 100. It shouldn't be a matter of multiple seconds, but the difference between 200ms (feels fast) and 2000ms (feels slow) is pretty big, and the value of those 900 other events is probably almost nothing. Downloading and rendering 1,000 full events on mobile is likely quite slow, too. |
src/applications/calendar/query/PhabricatorCalendarEventQuery.php | ||
---|---|---|
112–113 | Don't we want it to persist after each recurring event generates its ghosts? |
src/applications/calendar/query/PhabricatorCalendarEventQuery.php | ||
---|---|---|
112–114 | Oh, sorry, I only meant $map and $instance_sequence_pairs. | |
168 | We could potentially do even better here: if $end is set but $enforced_end is sooner, we can use $enforced_end instead (i.e., the sooner of $end and $enforced_end). | |
189–192 | Maybe >= instead of ==? I think we may end up with more results in some cases. |
pick soonest of $end and $enforced_end and make sure $enforced_end remembers the soonest of the two.