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

[Bug] ConfigStore.store() extremely slow #1480

Closed
Jasha10 opened this issue Mar 18, 2021 · 2 comments
Closed

[Bug] ConfigStore.store() extremely slow #1480

Jasha10 opened this issue Mar 18, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@Jasha10
Copy link
Collaborator

Jasha10 commented Mar 18, 2021

🐛 Bug

Description

Calling ConfigStore.store(name=..., node=MyDataclass) is extremely slow with certain dataclasses.

(tmp) jbss@rig1:~/mwe$ cat mwe.py
from hydra.core.config_store import ConfigStore
import time
from dataclasses import dataclass
from omegaconf import OmegaConf

cs = ConfigStore.instance()

@dataclass
class Config:
    iterp: str = "${long_string1xxx}_${long_string2xxx:${a_key}}"       # cs.store takes ~27s

t0 = time.time()
cs.store(name="config_schema", node=Config)
t1 = time.time()
print(f"Config Elapsed time = {t1-t0}")
(tmp) jbss@rig1:~/mwe$ python mwe.py
Config Elapsed time = 26.96069574356079

That's almost 27 seconds for the call to cs.store!
I did an ablation study to find that the length of long_string1xxx and long_string2xxx do matter; longer strings are slower.

@dataclass
class Config:
    iterp: str = "${long_string1xxx}_${long_string2xxx:${a_key}}"       # cs.store takes ~27s

    # ablation:

    # iterp: str = "${short1}_${short2:${a_key}}"                            # cs.store takes ~0.0002 seconds
    # iterp: str = "${long_string1}_${long_string2:${a_key}}"                # cs.store takes ~0.5s
    # iterp: str = "${long_string1x}_${long_string2x:${a_key}}"              # cs.store takes ~1.9s
    # iterp: str = "${long_string1xx}_${long_string2xx:${a_key}}"            # cs.store takes ~6.9s

    # iterp: str = "${long_string1xxx}_${short:${a_key}}"                    # cs.store takes ~0.07s
    # iterp: str = "${short}_${long_string2xxx:${a_key}}"                    # cs.store takes ~0.06s
    # iterp: str = "${short1}_${short2:${a_very_very_very_very_long_key}}"   # cs.store takes ~0.01 seconds

    # iterp: str = "${long_string2xxx:${a_key}}"                             # cs.store takes ~0.01s
    # iterp: str = "_${long_string2xxx:${a_key}}"                            # cs.store takes ~0.01s
    # iterp: str = "${long_string1xxx}_"                                     # cs.store takes ~0.0003s
    # iterp: str = "${long_string1xxx}"                                      # cs.store takes ~0.0003s
    # iterp: str = "${long_string1xxx}_${long_string2xxx}"                   # cs.store takes ~0.0003s
    # iterp: str = "${long_string1xxx}_${long_string2xxx:a_key}"             # cs.store takes ~0.003s

System information

Using the latest omegaconf and hydra installed from master branch.

Python 3.8.5 (default, Sep  4 2020, 07:30:14)
[GCC 7.3.0] :: Anaconda, Inc. on linux
omegaconf.__version__='2.1.0dev23'
hydra.__version__='1.1.0dev5'
  • Operating system : Ubuntu 18.04

Edit: I was not able to reproduce this with hydra/omegaconf downloaded from pip, only with the latest development versions of hydra/omegaconf.

@Jasha10 Jasha10 added the bug Something isn't working label Mar 18, 2021
@omry
Copy link
Collaborator

omry commented Mar 18, 2021

Thanks.
Can you narrow it down to a repro using OmegaConf only?

@Jasha10
Copy link
Collaborator Author

Jasha10 commented Mar 18, 2021

Filed against OmegaConf: omry/omegaconf#622

@Jasha10 Jasha10 closed this as completed Mar 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants