Skip to content

[class-parse] Use BufferedStream for up to 10x performance gain #1092

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 10, 2023

Conversation

jpobst
Copy link
Contributor

@jpobst jpobst commented Apr 3, 2023

While building AndroidX.sln, class-parse is taking up a considerable amount of time. After some quick profiling, this seems to be caused by reading from a ZipStream one or two bytes at a time. Wrapping the ZipStream in a BufferedStream makes the class-parse process about 10x faster on larger test cases.

main This PR
class-parse on API-33 android.jar (26.5 MB) 16.675s 2.759s
class-parse on androidx.compose.runtime.runtime (1.044 MB) 9.713s .893s
Total class-parse time building AndroidX.sln 5:48.46m 2:09.73m
Total time building AndroidX.sln 7:40.19m 4:42.34m

@jpobst jpobst changed the title [class-parse] Get 10x performance improvements with this one weird trick! [class-parse] Use BufferedStream for up to 10x performance gain Apr 4, 2023
@jpobst jpobst marked this pull request as ready for review April 4, 2023 19:34
@jonpryor jonpryor merged commit a172402 into main Apr 10, 2023
@jonpryor jonpryor deleted the buffered-stream branch April 10, 2023 20:01
jonpryor pushed a commit to dotnet/android that referenced this pull request Apr 11, 2023
Changes: dotnet/java-interop@0355acf...a172402

  * dotnet/java-interop@a172402a: [class-parse] Use BufferedStream to increase performance (dotnet/java-interop#1092)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants