FIX: Avoid needless copy from modules_to_save #2220
Draft
+32
−9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #2206
NOT READY TO MERGE YET.
Tentative solution to that issue.
The problem is that we keep a "global"
modules_to_save
on themodel
which contains all possiblemodules_to_save
for each adapter. When the first adapter targets layer "foo" withmodules_to_save
and the second adapter targets "bar", then "foo" will create a copy of the original module for the second adapter, even though it's not needed.This does not change the result but is unnecessary and takes up memory. Thus it should be avoided.
TODO: Tests.