Comments (10)
Although it's very performant and used in tons of applications the API for SDWebImage is sort of weird.
e.g. The API for prefetching:
Assign list of URLs to let SDWebImagePrefetcher to queue the prefetching, currently one image is downloaded at a time, and skips images for failed downloads and proceed to the next image in the list. Any previously-running prefetch operations are canceled.
completionBlock
block to be called when prefetching is completed first param is the number of completed (successful or not) requests, second parameter is the number of skipped requestsWeird things:
- One at a time.
- Cancels any previous prefetch operation.
- Tells you the number of successful and unsuccessful requests, not which images were successful or unsuccessful.
e.g. The API for headers:
headersFilter
Set filter to pick headers for downloading image HTTP request.
This block will be invoked for each downloading image request, returned NSDictionary will be used as headers in corresponding HTTP request.Weird things:
- Headers are not a property of each request (they should be).
- Why is a singleton property being used to dynamically determine the headers for each request?
- What if I had two requests to the same url that should have different headers?
(The api of headersFilter does not allow that)Maybe there's another native library we could use that's more straightforward than this.
All this strange behavior already been fixed via SDWebImage 5.0, react-native-fast-image already upgraded.
And I’m the maintainer of this framework and found these old suck behavior really painful.
If you have some more feature request, feel free to open https://github.com/SDWebImage/SDWebImage/issues.
If it’s not hack or hard-coded to any business logic, I’ll always provide a solution.
from react-native-fast-image.
My (not requested ;)) vote goes to Kingfisher.
It's a swift library with a great API and good memory management.
https://github.com/onevcat/Kingfisher
from react-native-fast-image.
Sorry I don't respond to stuff as quickly as I could. My work is primarily not React Native at the moment and I haven't had a lot of time for this. I think over the next few weeks I may have more.
@StevenMasini These issues in SDWebImage do sometimes leak through into issues for FastImage, it's just that they don't come up that often.
e.g.
- If you don't do prefetching then the prefetch issue will never come up for you.
- If you don't try to do things with headers than the headers issue won't come up for you.
I think in the common use case SDWebImage definitely performs well, and maybe the solution is trying to contribute to making it better, rather than trying to switch to something else.
@psugihara Thanks for the link to that. So far all I've found is https://bpoplauschi.wordpress.com/2014/03/21/ios-image-caching-sdwebimage-vs-fastimage/ , which is probably outdated at this point, and I haven't had the time to look at benchmarking things myself.
from react-native-fast-image.
What's the problem with SDWebImage ? What are the pros and cons of each library ?
I think we need to answer these question before making a decision.
From my experience SDWebImage is a very good library to deal with image cache, it's also one of the oldest. Let's establish the pros and cons list of the most interesting solution first.
Also what would be the advantage of rewriting the component from scratch ?
from react-native-fast-image.
The original post seems to be about improving the situation for developers of FastImage.
As a potential FastImage user, the most important thing to me is performance. Wanted to share this performance comparison I ran across: https://github.com/kean/Image-Frameworks-Benchmark
nuke looks pretty impressive
from react-native-fast-image.
@StevenMasini as noted by @psugihara some (important) cons of sdwebimage are reported in the original post.
@psugihara I didn't know nuke... It seems great! Is it possible for you to run your benchmark using the version 5 of Kingfisher?
from react-native-fast-image.
@faxioman not my benchmark, just a user there too :)
For clarification, I was noting that the cons in the OP are not at very compelling to me because as a user I'm completely abstracted from the underlying APIs. Performance + the API of FastImage itself are my concerns.
from react-native-fast-image.
Don't worry, I am not against changing or anything. Don't misunderstand me, I like to keep my mind open to alternatives. I just want to make sure this change worse it.
At least we have a good list of alternatives to consider now.
- Nuke · Swift
- Kingfisher · Swift
- AlamofireImage · Swift
- SDWebImage · Objective-C
- PINRemoteImage · Objective-C
from react-native-fast-image.
@DylanVann Indeed I don't use neither prefetching
nor headers
. I wasn't aware of these issues.
But maybe they could be fixed using SDWebImage.
After if Nuke performance are what they claim to be, why not moving to Nuke.
from react-native-fast-image.
Hi, has there been any movement on this?
from react-native-fast-image.
Related Issues (20)
- Support for iOS 17 HOT 22
- defaultSource not working HOT 2
- Need an alternative, this repo is dead HOT 15
- Error due tintColor HOT 2
- Is it abandoned? HOT 13
- Crashes the app, as IOS has deprecated UIGraphicsBeginImageContextWithOptions from IOS 17. HOT 7
- Critical WebP 0-day security CVE-2023-4863 HOT 3
- Gif in ios HOT 1
- Gifs only play once HOT 2
- react-native 0.73 [FFFastImageView setOnClick:]: unrecognized selector sent to instance HOT 5
- Android FastImage keeps refreshing on background to foreground, iOS is fine. HOT 3
- Android onError is not called when uri is empty or null HOT 1
- Kotlin support for the current React native version
- "FastImageView" was not found in the UIManager HOT 4
- Update to SDWebImage to 5.18.7 or higher for privacy manifest before Apple's May 1 deadline HOT 5
- App crashes when loading high resolution image. HOT 1
- setOnFastImageError
- Vulnerability reported by Snyk - libwebp HOT 1
- App crashed on Android if Source uri is empty HOT 3
- [Glide] Error: setDataSource failed: status = 0x80000000
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 react-native-fast-image.