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

onCreateViewHolder being called frequently and rapidly #13

Closed
kcorwin opened this issue Feb 3, 2015 · 4 comments
Closed

onCreateViewHolder being called frequently and rapidly #13

kcorwin opened this issue Feb 3, 2015 · 4 comments
Labels

Comments

@kcorwin
Copy link

kcorwin commented Feb 3, 2015

I noticed this in the app I'm working on, and it seems to be an issue in the example app as well. When I add logging statements to onCreateViewHolder (for example, in the CountryNamesAdapter in the example), I can see the method being called extremely frequently. Even a very slight scrolling movement will trigger tons of calls - as if it's happening for every redraw. onBindViewHolder is called with the same frequency.

Since onCreateViewHolder is where the expensive operations (xml inflation, findViewById, etc) are supposed to live, this seems like a big performance hit.

@TonicArtos TonicArtos added the bug label Feb 10, 2015
@TonicArtos
Copy link
Owner

Thank you for your bug report.

On inspection this appears to be a caching problem related to computing the position of headers partially off-screen. I imagine there will always be performance issues related to this but once the caching problem is solved the spamming of onCreateViewHolder should calm down.

@TonicArtos
Copy link
Owner

@kcorwin, All the extraneous calls to onCreateViewHolder should now be fixed. Please use v0.2.1.

@kcorwin
Copy link
Author

kcorwin commented Feb 18, 2015

This is a huge improvement. Thanks for all your work on this!

@TonicArtos
Copy link
Owner

You're welcome. Please let me know if there is anything else you run into.

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

No branches or pull requests

2 participants