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

Optimize indexPath search using visible cells #157

Merged
merged 1 commit into from
Jul 17, 2017

Conversation

rubencagnie
Copy link
Contributor

Searching for indexPaths could cause a lot of calculations. To find indexPaths for a given index, BrickKit will now first check the visible cells. If it can’t find it, it will continue to use the old, slower way

Fixes #152

@codecov-io
Copy link

codecov-io commented Jul 14, 2017

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #157   +/-   ##
=========================================
  Coverage          ?   93.48%           
=========================================
  Files             ?       39           
  Lines             ?     3207           
  Branches          ?        0           
=========================================
  Hits              ?     2998           
  Misses            ?      209           
  Partials          ?        0
Impacted Files Coverage Δ
Source/Cells/BrickCell.swift 97.84% <100%> (ø)
Source/ViewControllers/BrickCollectionView.swift 95% <88.88%> (ø)

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 aba87a8...b461b41. Read the comment docs.

return false
}
}
return cells.map({ (cell) -> IndexPath in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we do a flatMap here that would removed the need for the force unwrap too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch

Searching for indexPaths could cause a lot of calculations. To find indexPaths for a given index, BrickKit will now first check the visible cells. If it can’t find it, it will continue to use the old, slower way

Fixes #152
@rubencagnie rubencagnie force-pushed the 152-optimize-indexpath-search branch from 6756a27 to b461b41 Compare July 17, 2017 18:22
@jay18001 jay18001 merged commit 0c40780 into master Jul 17, 2017
@jay18001 jay18001 deleted the 152-optimize-indexpath-search branch July 17, 2017 19:47
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.

None yet

3 participants