Skip to content

Cache SingleElementSections.numberOfElements #29

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

Merged
merged 2 commits into from
Jan 19, 2021

Conversation

JosephDuffy
Copy link
Member

Overall this is pretty minor but when dealing with a lot of SingleElementSections that are infrequently updated is does start to slow down.

I thought a faster approach would be to use generics on replace(element:) to only check for nil when the value is Optional, but generics don't allow for this kind of overload.

Also added some basic tests. The performance tests show a ~9% performance increase.

@JosephDuffy JosephDuffy requested a review from shaps80 January 18, 2021 17:23
@JosephDuffy JosephDuffy merged commit 929e5b2 into master Jan 19, 2021
@JosephDuffy JosephDuffy deleted the improve-SingleElementSection-performance branch January 19, 2021 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants