Skip to content

ConfigParser doesn't need deepcopy #6463

@Nic-Ma

Description

@Nic-Ma

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:
ret = type(config)()

So I would suggest to remove this deepcopy logic, it can bring 3 benefits:

  1. If use python object in the config dict, deepcopy it may cause Invertd failure due to mismatch object ID.
  2. If the config structure contains very big python object (like CacheDataset), it will increase memory usage, especially considering it's a recursive operation.
  3. Some python objects may not support pickle operation and deepcopy will fail.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions