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

Java: Cache interpretElement. #15570

Merged
merged 1 commit into from
Feb 27, 2024

Conversation

aschackmull
Copy link
Contributor

@aschackmull aschackmull commented Feb 9, 2024

Henning noticed a lot of fastTC duplication (29x at the DIL level across a query suite). Cachaca has been saving us somewhat, but not completely, so this PR should eliminate the duplication.

@github-actions github-actions bot added the Java label Feb 9, 2024
@hmakholm
Copy link
Contributor

hmakholm commented Feb 9, 2024

Testing locally, this change does fix the duplication of work I noticed. 👍

@aschackmull aschackmull added the no-change-note-required This PR does not need a change note label Feb 12, 2024
@aschackmull aschackmull marked this pull request as ready for review February 12, 2024 08:45
@aschackmull aschackmull requested a review from a team as a code owner February 12, 2024 08:45
@aschackmull
Copy link
Contributor Author

DCA looks mostly uneventful, with a possible speedup on one project.

Copy link
Contributor

@atorralba atorralba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks plausible.

@@ -430,6 +430,7 @@ private Element interpretElement0(
}

/** Gets the source/sink/summary/neutral element corresponding to the supplied parameters. */
cached
Element interpretElement(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect that this is actually not the right thing to cache. I checked where it is used, and I think it ultimately boils down to the TDataFlowCallable newtype not being cached.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably also need to cache viableCallableExt in DataFlowImplCommon.qll.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latter is done here: #15582

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not so sure. There's a rather large dependency fan-out from interpretElement. And by not caching it, I can see that it would end up in at least two different DIL stages. It's used in at least ExternalFlow::sourceNode and ExternalFlow::sinkNode, which form their own stage, and in FlowSummaryImpl::summaryElement, which feeds into SummarizedCallableAdapter and its member predicates, which in turn feeds into the entire shared FlowSummaryImpl node synthesis. And the output of that is being used in at least two different cached stages as well (local steps are currently cached separately from the DataFlowImplCommon bulk caching).

@aschackmull aschackmull merged commit df5e753 into github:main Feb 27, 2024
16 checks passed
@aschackmull aschackmull deleted the java/cache-interpretelement branch February 27, 2024 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Java no-change-note-required This PR does not need a change note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants