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

Improve performance of SpoonUtil.resolveConstant #573

Open
Luro02 opened this issue Jul 14, 2024 · 2 comments
Open

Improve performance of SpoonUtil.resolveConstant #573

Luro02 opened this issue Jul 14, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request perf 🏎️💨 performance

Comments

@Luro02
Copy link
Collaborator

Luro02 commented Jul 14, 2024

Description

The current implementation is unnecessarily slow, because of redundant clones performed by the Evaluator. The clones are necessary for some Fold, because it would otherwise invalidate the model, but for looking up if a variable has a constant value like ctVariableReference.getDeclaration().getInitExpression() instanceof CtLiteral<?> ctLiteral, we can be a lot more conservative with cloning or skip it all together.

@Luro02 Luro02 added enhancement New feature or request high-priority Issues that should be solved as soon as possible perf 🏎️💨 performance labels Jul 14, 2024
@Luro02
Copy link
Collaborator Author

Luro02 commented Jul 14, 2024

Another idea was to clone them lazily like a clone on write, but not sure if that would be possible.

@Luro02 Luro02 self-assigned this Jul 14, 2024
@Luro02 Luro02 removed the high-priority Issues that should be solved as soon as possible label Jul 23, 2024
Luro02 added a commit to Luro02/autograder that referenced this issue Jul 24, 2024
@Luro02
Copy link
Collaborator Author

Luro02 commented Jul 26, 2024

The lazy cloning sounds like a nice idea but seems impossible to implement.

This would make it harder to implement Fold, but might solve the issue: The Fold impls will be responsible for cloning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request perf 🏎️💨 performance
Projects
None yet
Development

No branches or pull requests

1 participant