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

speed up loading of namespaces: return shallow copy in build_const_args #1103

Merged
merged 2 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
dataset based on the shape of the dataset data and the dimension names in the spec for the data type. This attribute
is available on build (during the write process), but not on read of a dataset from a file. @rly [#1081](https://github.com/hdmf-dev/hdmf/pull/1081)
- Speed up loading namespaces by skipping register_type when already registered. @magland [#1102](https://github.com/hdmf-dev/hdmf/pull/1102)
- Speed up namespace loading: return a shallow copy rather than a deep copy in build_const_args. @magland [#1103](https://github.com/hdmf-dev/hdmf/pull/1103)

## HDMF 3.14.2 (July 7, 2024)

Expand Down
3 changes: 1 addition & 2 deletions src/hdmf/spec/spec.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import re
from abc import ABCMeta
from collections import OrderedDict
from copy import deepcopy
from warnings import warn

from ..utils import docval, getargs, popargs, get_docval
Expand Down Expand Up @@ -84,7 +83,7 @@ class ConstructableDict(dict, metaclass=ABCMeta):
def build_const_args(cls, spec_dict):
''' Build constructor arguments for this ConstructableDict class from a dictionary '''
# main use cases are when spec_dict is a ConstructableDict or a spec dict read from a file
return deepcopy(spec_dict)
return spec_dict.copy()

@classmethod
def build_spec(cls, spec_dict):
Expand Down
Loading