Giter Site home page Giter Site logo

Comments (9)

njdehoog avatar njdehoog commented on September 7, 2024

Thanks for doing the research on this. I was expecting this could be a problem with larger data sets, but I had not tested this yet.

You're probably right that using a pure C implementation for the algorithm would increase performance dramatically. I don't have a lot of experience writing C code myself, so I might not get around to doing something about this for a while. If you are able to write a better/faster implementation of the algorithm, please issue a pull request, and I'll merge it back in.

from nhbalancedflowlayout.

ddaddy avatar ddaddy commented on September 7, 2024

I'm also seeing performance issues with this :(
It's looks really good in my app, but after implementing it the performance is poor when initially adding the images to the cell's.

I download images on a background thread for each cell and when finished I call 'reloadItemsAtIndexPaths' for that cell. At this point the scrolling gets really jittery.

If I change the layout to a standard UICollectionViewFlowLayout it flies.

from nhbalancedflowlayout.

mwyman avatar mwyman commented on September 7, 2024

ddaddy, in general you should not be reloading the cells when network connections come back with the image. You should really check out something like AFNetwork's asynchronous image views, as they can have much better scrolling performance in large collections or table views.

from nhbalancedflowlayout.

ddaddy avatar ddaddy commented on September 7, 2024

I have all the necessary background operations to make it all run smoothly. Like I said above, it runs perfectly fine when I substitute this layout for a standard one. The bottleneck is with the actual refresh of the cell or collectionView

from nhbalancedflowlayout.

njdehoog avatar njdehoog commented on September 7, 2024

Every time you do a reload on the collection view it needs to recalculate the positioning information for all the cells. That's probably what's causing the lag. Do you know the sizes of the images before you download them? Because then you wouldn't have to reload the cells.

from nhbalancedflowlayout.

ddaddy avatar ddaddy commented on September 7, 2024

How can I add the image to the cell without reloading the cell?
A lot of the images are on the device. I use an NSOperationQueue to check each one and if it's not available it downloads it from the net. The NSOperation returns with an image either from disc or web.

I guess the recalculation is just too complex and I may have to look at a simpler approach.

Thanks for your work.

from nhbalancedflowlayout.

njdehoog avatar njdehoog commented on September 7, 2024

When an operation completes you could ask the collection view for the corresponding cell by calling cellForItemAtIndexPath, and then set the image directly, without reloading the cell.

from nhbalancedflowlayout.

ddaddy avatar ddaddy commented on September 7, 2024

That's an idea, I hadn't thought of that.
I'll try now, thanks.

from nhbalancedflowlayout.

njdehoog avatar njdehoog commented on September 7, 2024

The main performance issues should be fixed in: 817a6ab

from nhbalancedflowlayout.

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.