Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9230057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:43:37+00:00 2026-06-18T05:43:37+00:00

I have a UICollectionViewController with a large dataset (>2000 items) with a custom layout.

  • 0

I have a UICollectionViewController with a large dataset (>2000 items) with a custom layout. Using sections, the scrolling performance became extremely choppy. Using Instruments and a few tests, I determined this was due to lookup in the layout (layoutAttributesForElementsInRect: ). I cache layout attributes in prepareLayout, and look them up here like so, in the fastest way I know of:

[elementsInfo enumerateKeysAndObjectsUsingBlock:^(NSIndexPath *indexPath, UICollectionViewLayoutAttributes *attributes, BOOL *innerStop) {

   if (CGRectIntersectsRect(rect, attributes.frame)) [allAttributes addObject:attributes];

}];

I found that ~25% of cpu time was spent enumerating this, mostly on [NSIndexPath isEqual:]. So, I need a faster way to hash these values.

It must be possible, because I did a cross test using the same data with a sectioned UICollectionViewFlowLayout and it was smooth.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T05:43:38+00:00Added an answer on June 18, 2026 at 5:43 am

    Well, turns out using arrays instead of dictionaries, and filtering by an NSPredicate was much faster since in this case the indices were already known.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background: I have a UICollectionViewController that shows items in one of two modes, which
I have created a UICollectionViewController custom class , and I inserted an UIImageView into
I have a UICollectionViewController that I load when a user turns their iPad so
Have got a method which returns IEnumerable<User> which I have been using Linq /
I have a UICollectionViewController : - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { return [self.pageTastes count]; }
Have created a ATL COM project through which I am inserting Menu Items to
I'm subclassing UICollectionViewController. UITableView header repeats after every row of cells that i have.
I'd consider myself advanced in getting smooth scrolling performance, but this has stumped me.
Only my second time using UICollectionView's and perhaps I have bitten off more than
Have whats probably a simple problem with using parent in if and each statements

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.