Closed ColtonIdle closed 6 years ago
Images are batched in 180ms chunks to the main thread after decode. If you enable logging you will see a summary of the internal events which result in the image being delivered to the main thread. The first image load will also be subject to HTTP client initialization and thread creation which will slow things down. 300ms sounds about normal.
On master
we've removed the batching, but it still isn't going to ever be instant because it has to roundtrip through a background thread, initialize the HTTP client, perform the decode, and perform any transformations.
@JakeWharton so there's no magical caching strategy or something that I'm missing?
Is there anyway to get this to be synchronous by chance? I sold my PMs on the idea of offloading images to the web for smaller apk, then they only ever need to be downloaded once, and they will act like natively packaged images, but my PM called me out on the placeholder image being present for a short period and said how natively packaged images don't do that.
You can invoke Picasso synchronously or request the image synchronously using OkHttp directly but I wouldn't recommend it as you're going to block the main thread during app startup and create an unresponsive experience.
Thanks @JakeWharton I'll try a few things out and see how they end up. Feel free to close this issue.
Hey @ColtonIdle, did you come up with a solution to this? I'm running into the exact same problem. I have my PMs on my back complaining how our iOS counterpart is displaying cached images instantly, and we are not. Would appreciate any input on how to improve this if possible!
I would like to preface that I've read a bunch of SO posts and looked through a bit of the code and I just find myself scratching my head with Picasso.
I have a single requirement/assumption about Picasso. Picasso will load images instantly if they have been downloaded before (disk/ram cache).
My sample app consists of:
Is 7 and 8 unreasonable?
The reason I want them to be instant is that we're going through an initiative to essentially offload all bitmaps to the web and not ship them with the app for lighter apks. These images will never have their URLs changed. Right now we are definitely stress testing with full bleed images before we introduce thumbor, but even before we do so it makes sense that if I cram any images into the apk, they load "instantly" in onCreate and are there right when the user sees the activity, but not with picasso. I feel like I'm missing something.