

Show HN: Faster Image Loading on Android is now a one-liner - mulchpower
https://github.com/nextopio/nextop-client/blob/master/docs/03.02.2015_FAST_IMAGE_LOADING_EASY_INTEGRATION.md

======
icecubed
Very cool! Two questions:

1) How do you ensure that the images are not cached to compare the load times
in the demo?

2) Do you expect the load to ever be significant enough that dropping messages
will become necessary? If so, how are you planning to handle that?

~~~
mulchpower
Hi! Really great questions. Thank you.

1- Both apps do the same client-side caching, with no server-side caching. The
Nextop protocol is able to get bytes down faster from raw requests than direct
HTTP (limited to 2 concurrent connections). An update to the proxy will be
coming out soon that does caching like a proper CDN, which will be a big win.
Look out for other performance improvements this week too (I can discuss more
if you want).

The bottom line is that Nextop ImageView loads your images >=HTTP/2 with zero
changes to your backend. This is a huge win for developers wanting to make the
switch now.

2-The client supports prioritization+multiplexing to handle that. More
important messages will always be sent at the head of the line, regardless of
the backlog. The important thing to remember is that the connection is a bunch
of pipelines (Nextop calls them groups), where messages in each pipeline get
sent in order, and pipelines get merged into a single stream out/in.

Now a lot of messages that drive views like GETs aren't necessary when the
view goes off the screen. Nextop handles that case for you with some nice
integrations between view and requests, which can help the backlog. If your
app needs to cancel/merge messages like, for example, an app sending a stream
of geo updates, Nextop supports canceling a message which will remove from the
queue if present. "canelSend(p); send(p = current);" one pattern to manage the
backlog for messages that can be replaced with newer versions.

We're rolling out some prefetching/offline stuff in the next couple weeks that
will really highlight this.

Now the memory impact of the backlog is important. I think letting Nextop
abstract that and improve is better than pushing memory issues into the rest
of the app. In general the Nextop philosophy is a simple API that does the
right thing with a broad range of input/output values. All the special cases
will go into the library to save developers' headaches. Nextop eventually
reaches zero memory use and gives you the tools to manage memory/bandwidth use
by crafting how your app sends messages. For example, downsampling a camera
photo for upload is a one-liner in Nextop.

------
mulchpower
Developer here. Love to discuss performance and mobile. Building a network
library from the ground up for mobile.

