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 improvement with cell reuse #100

Merged
merged 16 commits into from
Oct 15, 2018
Merged

Performance improvement with cell reuse #100

merged 16 commits into from
Oct 15, 2018

Conversation

lkzhao
Copy link
Collaborator

@lkzhao lkzhao commented Sep 23, 2018

Regarding #97
@Banck gives us a brilliant idea of not removing the cells from CollectionView.
This brings major improvement in main thread cpu time.

With 10s scrolling session, reuseManager's lifeSpan set to 5.0s. and scrolling from top to the end every 1 second. We get the following result on an iPhone X.

Notices that CollectionView.loadCells() cpu time changed from 558ms to 288ms.

Before

screen shot 2018-09-22 at 9 59 41 pm

After

screen shot 2018-09-23 at 7 41 03 am

UICollectionView

And just for comparison with UICollectionView.
UICollectionView has about the same scroll performance as CollectionKit after this patch.
screen shot 2018-09-23 at 7 53 35 am

@lkzhao lkzhao requested a review from jindulys September 23, 2018 14:19
@brightfuture
Copy link

Absolutely amazing improvement! 👏🏻

@rebeloper
Copy link

Can’t wait for this to be accepted! :)

@codecov-io
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (master@cc63503). Click here to learn what that means.
The diff coverage is 75%.

Impacted file tree graph

@@           Coverage Diff            @@
##             master    #100   +/-   ##
========================================
  Coverage          ?   56.1%           
========================================
  Files             ?      35           
  Lines             ?     991           
  Branches          ?       0           
========================================
  Hits              ?     556           
  Misses            ?     435           
  Partials          ?       0
Impacted Files Coverage Δ
Sources/Extensions/UIView+CollectionKit.swift 58.33% <75%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cc63503...33ad680. Read the comment docs.

@lkzhao lkzhao merged commit 9b0571d into master Oct 15, 2018
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

Successfully merging this pull request may close these issues.

5 participants