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

Reduce object creation during solving #985

Merged
merged 4 commits into from
Dec 7, 2022
Merged

Reduce object creation during solving #985

merged 4 commits into from
Dec 7, 2022

Conversation

cprudhom
Copy link
Member

@cprudhom cprudhom commented Dec 7, 2022

No description provided.

@cprudhom cprudhom added this to the 4.10.11 milestone Dec 7, 2022
@cprudhom cprudhom requested a review from jgFages December 7, 2022 16:22
@jgFages
Copy link
Contributor

jgFages commented Dec 7, 2022

Would you say more generally that one should avoid :

  • declaring lambda on the fly ?
  • using streams ?
    when the calls are used at each node?

@cprudhom
Copy link
Member Author

cprudhom commented Dec 7, 2022

Using stream during the resolution should be carefully done.
If an alternative exists without stream, it should be preferred. Note, that it could require the introduction of new method (like I did with Variable.forEachPropagator).

Using lambdas is more or less the same.
If predefined functions/consumers/... can be extracted, that's better: profiling is easier and it limits the creation of objects (but it might increase the size of a model...).
Using lambda to save IOperation is OK, though, because a new instance is necessary.

@jgFages
Copy link
Contributor

jgFages commented Dec 7, 2022

Thanks. It confirms my experience of streams within algorithms.

@cprudhom cprudhom merged commit 5af9f17 into master Dec 7, 2022
@cprudhom cprudhom deleted the dev_redobjcre branch December 7, 2022 17:26
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.

2 participants