Skip to content

SafetyPropagationTransfer is slow because of heavy exception throwing #2942

@ash211

Description

@ash211

What happened?

Running with gradle-jfr on one of my repos, I found that my compileJava task was throwing tens of thousands of exceptions:

Screenshot 2024-11-04 at 10 43 07 PM

Looking at the causes, I think it's mostly related to gradle-baseline's SafetyPropagationTransfer class

Screenshot 2024-11-04 at 10 43 34 PM
Screenshot 2024-11-04 at 10 43 29 PM
Screenshot 2024-11-04 at 10 41 13 PM

Specifically the getPath call on this line:

It seems like that call ends up throwing lots of Exceptions farther down in the com.sun.source code, and heavy use of Exceptions can cause slowness: https://shipilev.net/blog/2014/exceptional-performance/

What did you want to happen?

SafetyPropagationTransfer to run in a way where there aren't a lot of Java exceptions generated, so JFR doesn't show the "Thrown Errors" automated analysis result and ultimately gradle-baseline runs faster.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions