Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Xamarin.Android.Build.Tasks] ResolveLibraryProjectImports temp files
When reviewing `ResolveLibraryProjectImports`, I noticed a few things we could improve: 1. We are using `GetResourceData` to get the entire contents of a file as a `byte[]` and then writing to disk. 2. We are writing temporary zip files to disk, reading them to extract, then deleting them. The first thing I did was take advantage of the `GetResourceStream` method, so we could just do `stream.CopyTo(file)`. This prevents us from allocating big `byte[]` the size of each file. Next, I took advantage of `ZipArchive.Open (stream)` and `GetResourceStream` to avoid the need for creating temporary zip files. We can unzip directly from the `Stream` in memory. ~~ Results ~~ When timing these changes, I used the Xamarin.Forms integration project in this repo: Before 1. 1793 ms ResolveLibraryProjectImports 1 calls 2. 1780 ms ResolveLibraryProjectImports 1 calls 3. 1770 ms ResolveLibraryProjectImports 1 calls After 1. 1750 ms ResolveLibraryProjectImports 1 calls 2. 1740 ms ResolveLibraryProjectImports 1 calls 3. 1702 ms ResolveLibraryProjectImports 1 calls I would say the improvements here are around 50ms.
- Loading branch information