Comments (9)
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.
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.
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.
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.
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.
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.
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.
That's an idea, I hadn't thought of that.
I'll try now, thanks.
from nhbalancedflowlayout.
The main performance issues should be fixed in: 817a6ab
from nhbalancedflowlayout.
Related Issues (20)
- Crash HOT 5
- Asynchronously loading preferredSizeForItemAtIndexPath
- maximumRowHeight or item height? HOT 5
- Adding new items to the collection rearranges old cells HOT 3
- Images are upscaled during the layout HOT 4
- Change back layout from UICollectionFlowLayout to NHBalancedFlowLayout cause crashes HOT 1
- Add supplementary views HOT 1
- How to use NHBalancedFlowLayout HOT 2
- Layout issue with xcode 6 GM HOT 12
- Images does not fill cell frame HOT 3
- Not working without Xib file HOT 4
- Randomize cell size HOT 1
- Bug on reload
- how i can force it to make 2 2 2
- Load images remotely HOT 1
- Crash
- Performance on large camera roll HOT 2
- i need fix row height with horizontal scroll, but its not working HOT 1
- Huge amount of items
- Wrong collectionViewContentSize HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nhbalancedflowlayout.