Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance issue #181

Closed
achatina opened this issue Jul 15, 2020 · 7 comments · Fixed by #192
Closed

Performance issue #181

achatina opened this issue Jul 15, 2020 · 7 comments · Fixed by #192
Labels
enhancement New feature or request

Comments

@achatina
Copy link

Hi there.
Great lib, but it has really big problems with optimizations on long-range setup (e.g. -100 years, +100 years) because of generateWeekDays. It calls for each month and loads main thread. On a weak device it could take up to 5-10 seconds, which looks not very good. Seems like you need to review this approach.
You can find it in Example3 if you set up it like this:

 setup(currentMonth.minusYears(100), currentMonth.plusYears(100), daysOfWeek.first())

Снимок экрана от 2020-07-15 14-40-42
Снимок экрана от 2020-07-15 14-24-08
Снимок экрана от 2020-07-15 14-49-11

@kizitonwose
Copy link
Owner

You are right. I have been considering a setupAsync() alternative to the setup() method that basically does the date generation in the background and updates the calendar when ready. Just haven't got the time to actually implement it. Hopefully this weekend or the next one 🤞.

@achatina
Copy link
Author

It would really help. Moreover, I want to suggest to you, check generating months dynamically after user's swipe. It could also become a part of infinite calendar. But it seems that it need to rewrite lot of logic, so mb think about it for far future

@bmilovanovic
Copy link

First of all, thank you @kizitonwose for such a wonderful library. I appreciate the time that you spent on making so many things customizable. Unfortunately, I must say that the performance is a dealbraker for me. I have a BottomNavigationView in my app, and when I switch to the CalendarView, it takes a whole lot for the tab to be displayed. I did not dive into the code so I don't know what is the problem here, but I may assume that you're generating all the months and days that are not visible (I concluded this because the scrolling is super smooth). Is there a way for me to configure this? The scrolling isn't important for me. Lazy loading is definitely what you should do here.

@kizitonwose
Copy link
Owner

I want to suggest to you, check generating months dynamically after user's swipe. It could also become a part of infinite calendar. But it seems that it need to rewrite lot of logic, so mb think about it for far future

Yep, this is on my TODO, just need to find the time.

@kizitonwose
Copy link
Owner

Is there a way for me to configure this? The scrolling isn't important for me. Lazy loading is definitely what you should do here.

Not at the moment but the async setup should come this weekend(hopefully), and that should be sufficient until lazy loading is possible.

@kizitonwose kizitonwose added the enhancement New feature or request label Jul 23, 2020
@michaeltys
Copy link

Would be really great to get this feature

@kizitonwose
Copy link
Owner

Happy to announce that setupAsync is now available in 0.4.1.
There are also other async methods for related tasks like updating the start and end months, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants