Is your feature request related to a problem? Please describe.
In the current implementation, ConfigParser executes deepcopy for every config item when recursively parse the whole config:
|
item_conf = deepcopy(config) |
But actually, all the parsing logic just read the config item content and generate a new config object:
So I would suggest to remove this
deepcopy logic, it can bring 3 benefits:
- If use python object in the config dict,
deepcopy it may cause Invertd failure due to mismatch object ID.
- If the config structure contains very big python object (like CacheDataset), it will increase memory usage, especially considering it's a recursive operation.
- Some python objects may not support pickle operation and deepcopy will fail.
Is your feature request related to a problem? Please describe.
In the current implementation,
ConfigParserexecutesdeepcopyfor every config item when recursively parse the whole config:MONAI/monai/bundle/config_parser.py
Line 379 in 8e8dd1b
But actually, all the parsing logic just read the config item content and generate a new config object:
MONAI/monai/bundle/reference_resolver.py
Line 295 in 8e8dd1b
So I would suggest to remove this
deepcopylogic, it can bring 3 benefits:deepcopyit may causeInvertdfailure due to mismatch object ID.