Giter VIP home page Giter VIP logo

Comments (2)

wtmoose avatar wtmoose commented on June 4, 2024

some performance issues with the data model

TLIPT shouldn't have performance issues with 700 items. However, we've experienced performance issues with UICollectionView's internal batch update process when the number of items gets that large. UICollectionView just can't handle large batch updates.

Did you specifically identify a performance problem within the TLIPT code?

So I figured that just clearing out the collection view and then rebuilding it would make it faster, and it does.

The way we've handled this problem is to use [UITableView reloadData] instead of performing batch updates. We did this inside a [UIView transitionWithView] with a page flip animation.

It sounds like what you're trying to do is perform one batch update from your old data model to an empty date model, followed by another batch update from the empty data model to the new data model. Is that right?

Here's what happening. If TLIPT can't determine the section name for an item, then it puts it in a section with the internal name TLIndexPathDataModelNilSectionName. There is a bug in UICollectionView that crashes if you try to load the view with zero sections. So TLIndexPathDataModel has a workaround of creating an empty section using the internal section name. Here are the comments from the code:

if there are no sections, insert an empty section to keep UICollectionView
happy. If we don't do this, UICollectionView will crash on the first
update because it internally thinks there is 1 section when the
UICollectionView controller reports zero sections.

I have not checked if that bug still exists in iOS8. I'll put that on my todo list.

My recommendation, and what I've done in the past, is to set up your delegate to return a blank view or zero size for that section. Or you could try setting the data model to nil and see if the collection view crash bug has been fixed. As I recall, the bug only happened on the first update, so it might not affect you at all.

from tlindexpathtools.

ericdevries avatar ericdevries commented on June 4, 2024

The code is indeed only slow when it has to move around all the items. The comment in that bit of code (https://github.com/wtmoose/TLIndexPathTools/blob/master/TLIndexPathTools/Data%20Model/TLIndexPathUpdates.m#L364) also shows a better suggestion, which I didn't see until after posting this comment.

I did implement the solution based on the comment and now it works acceptably fast. Thanks for the suggestions

from tlindexpathtools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.