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

Problem with performance in case of dequeueReusableCell #23

Open
karpov3 opened this issue Sep 28, 2017 · 3 comments
Open

Problem with performance in case of dequeueReusableCell #23

karpov3 opened this issue Sep 28, 2017 · 3 comments

Comments

@karpov3
Copy link

karpov3 commented Sep 28, 2017

Hi @sergdort , thank you for your interesting work. We got a lot of inspiring things from that.

I would like to share one of the problem that we are trying to resolve in process of adopt Input, Output and transform method between View and ViewModel.

In our project we use RxSwift + MVVM + Coordinator. ViewModel of Cell in our UICollectionView has to implement some work for UI of cell. So when UICollectionViewDataSource calls dequeueReusableCell every time Cell calls method transform and create new output from ViewModel. It requires a little bit of time for UI so it’s visible on scroll. In our first approach, Cell subscribed on event of already created VIewModel and it worked fine (but this solution was less functional). Now we call every time transform method and it blocks UI on scroll because ViewModel should be recreated every time.

Did you ever think about similar situation or do you have some ideas how it can be resolved?
Thank you

@sergdort
Copy link
Owner

Hi, @karpov3

This is an interesting problem. TBH I've never encountered any performance issues with Rx. I wonder is it establishing transformations takes so much time (and it's really surprising, as it's just allocation of some operator classes)
Are you sure that you're not doing any heavy computations on subscription?

@karpov3
Copy link
Author

karpov3 commented Oct 2, 2017

@sergdort Yes, I have pretty complex cell, because inside of it I have another CollectionView. Every time when cell is reused, in transform method I initialize viewmodels for nested CollectionView. It takes time. Temporary, to resolve the issue, I removed from transform Driver that initialize viewmodels for nested collectionView and declared it as a constant.

@sergdort
Copy link
Owner

sergdort commented Feb 4, 2018

Yeah, I would not use this solution for `UI{Table/Collection}ViewCell. And have them as a constant property on a VM

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

No branches or pull requests

2 participants