Skip to content

CheckReturnValue: avoid unnecessary work during rule evaluation - #6314

Open
copybara-service[bot] wants to merge 1 commit into
masterfrom
test_1013480905
Open

copybara-service[bot] wants to merge 1 commit into
masterfrom
test_1013480905

Conversation

@copybara-service

Copy link
Copy Markdown
Contributor

CheckReturnValue: avoid unnecessary work during rule evaluation

  • Evaluate ResultUsePolicyEvaluator rules with loops rather than nested
    stream pipelines. Rules are evaluated in the same order and evaluation
    stops at the first rule that returns a policy, as before.
  • In the AutoValue rules, check whether each supertype in the closure of
    the method's owner has the relevant annotation before searching that
    supertype for a supermethod, and use ClassName to cache the binary
    annotation name.
  • Don't use a stream to find CRV-relevant annotations on each method and
    class.

On Chromium's chrome_java target (median of 5 interleaved runs, idle machine), time spent in CheckReturnValue drops from 459ms (453ms after Round 1) to 292ms (-36%).

* Evaluate ResultUsePolicyEvaluator rules with loops rather than nested
  stream pipelines. Rules are evaluated in the same order and evaluation
  stops at the first rule that returns a policy, as before.
* In the AutoValue rules, check whether each supertype in the closure of
  the method's owner has the relevant annotation before searching that
  supertype for a supermethod, and use ClassName to cache the binary
  annotation name.
* Don't use a stream to find CRV-relevant annotations on each method and
  class.

On Chromium's chrome_java target (median of 5 interleaved runs, idle machine), time spent in CheckReturnValue drops from 459ms (453ms after Round 1) to 292ms (-36%).

PiperOrigin-RevId: 1013480905

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants