Android: Change desugar to not cache stateless lambdas
Saves 15kb of dex and 300 dex methods by removing the <clinit>() from them. While it is sometimes a good idea to cache instances of inner classes, there are several reasons why having it be automatic is not a good idea: * Since caching happens only for stateless lambdas, it is too subtle. I don't think most devs are mindful of stateful vs. stateless lambdas when creating / modifying them. The syntax is the same for both. * Many lambdas are used only once. Adding in a <clinit>() adds synchronization overhead & an extra function call. Bug: 952833 Change-Id: I9ab1474c93b2732954b6df5159ac89049f1bfcf1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1902476 Auto-Submit: Andrew Grieve <agrieve@chromium.org> Commit-Queue: Sam Maier <smaier@chromium.org> Reviewed-by:Sam Maier <smaier@chromium.org> Cr-Commit-Position: refs/heads/master@{#714685}
Showing
Please register or sign in to comment