JTAppleCalendar
JTAppleCalendar copied to clipboard
Performance issue in -setMinMaxDate
Version Number: 8.0.3
Description
Selecting big ranges of dates around 2-3 years in range is causing performance penalties when finishing the selection due to sorting of big selected cell collections.
Parts of the call stack:
2.94 s 96.6% 0 s JTACMonthView.selectDates(from:to:triggerSelectionDelegate:keepSelectionIfMultiSelectionAllowed:)
2.90 s 95.2% 0 s JTACMonthView.selectDates(_:triggerSelectionDelegate:keepSelectionIfMultiSelectionAllowed:)
1.64 s 53.9% 0 s JTACMonthView.handleSelectionValueChanged(_:action:indexPath:selectionType:shouldTriggerSelectionDelegate:)
1.52 s 49.8% 0 s JTACMonthView.setMinMaxDate()
1.48 s 48.6% 0 s specialized Sequence<>.sorted()
Steps To Reproduce
Select a big range of dates that at least contain 3-4 years of data
Expected Behavior
Date selection should not block the interface responsiveness.
Additional Context
Why are all selected cells cached in JTACMonthView.selectedCellData? It should be possible to infer the selected state of cells in between two dates by just checking if the start and end date range contains a given date.
Does the issue mentioned here help? https://github.com/patchthecode/JTAppleCalendar/issues/1201
I need to check if it will resolve the issue. But back to the original question is there a reason why we are holding the dictionary with all the values in it? Because if there is no dependency to other related features we could do some major performance improvement in the library.
Yes, I believe that I am using it. In order to tell you how, I'll have to do a look at it again. I'm a little tied up on another project, but i'll get back to this shortly.