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

Fix #2946: Avoid evaluating T.inputs twice #2952

Merged
merged 2 commits into from
Jan 7, 2024
Merged

Conversation

lolgab
Copy link
Member

@lolgab lolgab commented Jan 6, 2024

Fixes #2946

In evaluateNamed, after evaluating Tasks we are matching for ImputImpl[_] instances to construct a Watchable.
A Watchable instance contains a hashCode for the current result and a callback to evaluate it again and get the next result.
Instead of using the current result which was contained in TaskResult, we were already calling the recalc callback, which executes again the T.inputs and performs their side effects twice.
Now we are returning the hashCode for the already computed result, so we don't execute the recalc callback right away.

Pull Request: #2952

@lolgab lolgab marked this pull request as ready for review January 6, 2024 18:27
@lolgab lolgab requested a review from lefou January 6, 2024 18:27
@lefou lefou requested a review from lihaoyi January 6, 2024 20:58
Copy link
Member

@lihaoyi lihaoyi left a comment

Choose a reason for hiding this comment

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

Looks reasonable I think. @lolgab can you update the PR description with your understanding of the problem and your proposed solution before merging it?

@lolgab lolgab merged commit 5c1f37b into com-lihaoyi:main Jan 7, 2024
35 of 36 checks passed
@lolgab lolgab deleted the fix-#2946 branch January 7, 2024 10:08
@lefou lefou added this to the 0.11.7 milestone Jan 7, 2024
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.

T.inputs are evaluated twice
3 participants