Hackernoon logoPicasso, Universal Image Loader or Glide? That’s the question. by@shollmann

Picasso, Universal Image Loader or Glide? That’s the question.

Santiago Hollmann Hacker Noon profile picture

Santiago Hollmann

Android developer

Original picture: https://unsplash.com/photos/-6mZyblCys4

Every time I started a new Android project or while I was working on existing ones, I used to wonder which image library should I use.

I have to admit that I have looked for some comparison among this libraries to understand how they perform but I haven’t found any benchmark that really satisfies me. That’s why I decided to make my own comparison between Picasso, Universal Image Loader and Glide.

Note: Maybe you wonder why Fresco (the option provided by Facebook) is not among my options. This library uses its own custom view to display images (called Drawee) so, you should use it instead of ImageView. As I was running this test in an existing project and entirely refactoring it was not one of the options (because of the Drawee thing), I couldn’t choose it as the winner. Specially, if I still could get very good results from the other three. Sorry Fresco fans and Facebook!

What did I compare?

Memory and CPU consumption, amount of methods (because of the 65k methods limit), networking, size and ease to implement.

How did I test?

I had a list of 200 elements that included an image. Images (180 x 135 px) were no repeated and they were loaded from the server on the first run. I scrolled up and down three times the list to measure the use of networking, CPU and memory.

The idea was to use each library how it was “out-of-the-box”. For Universal Image Loader I had to set manually to cache on memory and disk and for the memory benchmark I used Picasso with its default memory cache limit and with a custom limit of 25 mb.

This is a part of the listing that was scrolled during the test.

Show me the results!

Size in kilobytes of each JAR. The winner is Picasso.
Measured with Dexcount Gradle Plugin by KeepSafe. The winner is Picasso.
Measured from Android Studio. The winner is Universal Image Loader.

What about network and CPU? There were no noticeable difference in these two aspects.

And… what about ease to implement? Well, all of them are easy to use. Universal Image Loader needs a few more lines (let’s say ~4 more lines) before using it as well as the other competitors. Regarding Picasso, although it is easy to use, I found that it easily generates memory leaks in situations where the others had no issues of that kind. Regarding Glide, I had nothing to add, it works greatly just out of the box.

So, what did I learn?

I can say that all the libs mentioned above are great and really makes easy the usage of images on Android. Thanks for that guys.

I would recommend the following:

  • Existing Projects: I recommend Universal Image Loader (or switch to it) because of its customization, low memory consumption and good balance between methods and size.
  • Small projects: I would choose Glide. I really like its simple implementation and where the Picasso implementation on my code has memory leaks, Glide doesn’t (neither Universal Image Loader).
  • Currently using Picasso? I think it is OK if you are sure that you have no memory leaks and you control how much cache memory is using.
  • and… Fresco!? Well, as far as I know, it is a really good library. I would try it out if I have to start a project from scratch.

Did you like what you read?
Recommend this story (by clicking the ❤ button) so other people can see it!
You can also react on Twitter @santihollmann


Join Hacker Noon

Create your free account to unlock your custom reading experience.