Skip to content
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

Remove the need for javac to generate synthetic methods. #3587

Merged
merged 1 commit into from
Dec 27, 2015
Merged

Remove the need for javac to generate synthetic methods. #3587

merged 1 commit into from
Dec 27, 2015

Conversation

JakeWharton
Copy link
Contributor

Outer classes accessing inner class private fields and methods (and vise versa) causes javac to generate package-scoped trampolines. These bloat the class files, adds overhead to the inliner analysis, and for Android create needless method that eat away at our fixed limit of methods in an application. By simply promoting the private interactions to package scope directly, the synthetic methods do not need generated.

2.5% of RxJava's methods were these needless generated trampolines accounting for 1.2% of jar size and 1.4% of dex size.

$ dex-method-count before.dex
5005

$ dex-method-count after.dex
4875
-rw-r--r--   1 jw  jw   699K Dec 25 03:08 after.dex
-rw-r--r--   1 jw  jw   952K Dec 25 03:08 after.jar
-rw-r--r--   1 jw  jw   709K Dec 25 03:06 before.dex
-rw-r--r--   1 jw  jw   964K Dec 25 03:06 before.jar

Outer classes accessing inner class private fields and methods (and vise versa) causes javac to generate package-scoped trampolines. These bloat the class files and for Android create needless method that eat away at our fixed limit of methods in an application. By simply promoting the private interactions to package scope directly, the synthetic methods do not need generated.
@akarnokd
Copy link
Member

👍

1 similar comment
@zsxwing
Copy link
Member

zsxwing commented Dec 27, 2015

👍

akarnokd added a commit that referenced this pull request Dec 27, 2015
Remove the need for javac to generate synthetic methods.
@akarnokd akarnokd merged commit 884e49b into ReactiveX:1.x Dec 27, 2015
@JakeWharton JakeWharton deleted the jw/remove-synthetic-methods branch August 20, 2016 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants