Question

I've got an app that will be doing a fair amount of communication with a server over HTTP, and these connections may be overlapping. I'm planning to load the data asynchronously. I understand that there is a performance hit associated with allocating memory, so I figured the smart thing to do would be to keep a set of available connection objects so that every time I needed to communicate with the server there would be a good chance that I wouldn't have to allocate a new connection, just reuse an idle one. However, there doesn't seem to be a way to fire up an existing connection with a new request object. Is this something I'm missing, or am I barking up the wrong tree?

Was it helpful?

Solution

Obey the golden rule of performance optimization: Measure first. It is quite probable that the performance hit caused by allocating a new connection object is going to be negligible.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top