segmentio/analytics-android — pull request #145 by f2prateek (2014-12-12 22:29:05+00:00)
Title: Stream Batch Payloads

This is the first part of the change that will solve https://github.com/segmentio/analytics-android/issues/139. The second part is to make improvements in the JSON serialization code itself.

By streaming the payloads we can avoid the need to allocate memory to collect them, and save cycles by alleviating the need to deserialize the payloads (on the assumption they were serialized in JSON).

This also caps the max batch size at 50, any more and we'll make multiple network calls if the queue has more events than that. This may be too strict, so we may need to reevaluate the number.

This change also caps the disk queue size. We can theoretically grow to 2GB, but we should stop way before that, currently implemented to stop at 1000 events.

Lastly, this will remove the memory queue fallback.