gggard/AndroidCaldavSyncAdapater — pull request #188 by Griffon26 (2014-04-07 20:37:03+00:00)
Title: Use EntityUtils.toString() as a faster way to get entity content

While debugging a different issue I noticed that extracting the content from an entity was done by concatenating to a string line by line. This was causing a realloc of everything up to that point each time through the loop and was taking a lot of time for the initial sync of a calendar with a lot of items. I aborted a measurement of the original code after 10 minutes. The new code did it in 5 seconds.

I replaced three instances of this type of string concatenation with EntityUtils.toString(), which turned out to be more or less equal in speed to using a StringWriter or a StringBuilder, but is much fewer lines of code.