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

Import is slow #3062

Open
dabacon opened this issue Jun 3, 2020 · 5 comments
Open

Import is slow #3062

dabacon opened this issue Jun 3, 2020 · 5 comments
Labels
area/imports area/packages area/performance kind/health For CI/testing/release process/refactoring/technical debt items

Comments

@dabacon
Copy link
Collaborator

dabacon commented Jun 3, 2020

import cirq takes around 1.5 seconds (this is in colab).

Would be nice to get some other numbers from users as to what they are seeing.

@cduck
Copy link
Collaborator

cduck commented Jun 3, 2020

New MacBook, Python 3.8, Cirq master (7191cb57):

$ python -c 'import time; time.sleep(1); t1 = time.monotonic(); import cirq; t2 = time.monotonic(); print(t2-t1)'
1.65165978 (±0.05)

@vtomole
Copy link
Collaborator

vtomole commented Jun 3, 2020

Ubuntu 18.04

(venv3.6) vtomole@vtomole:~$ python -c 'import time; time.sleep(1); t1 = time.monotonic(); import cirq; t2 = time.monotonic(); print(t2-t1)'
4.911438770999666

@alexandrupaler
Copy link
Collaborator

Ubuntu 18.04. i5-8250U
python3 -c 'import time; time.sleep(1); t1 = time.monotonic(); import cirq; t2 = time.monotonic(); print(t2-t1)' executed sequentially

2.7808562550017086
1.722753725000075
1.588053849998687
1.700277088002622
2.827545382999233

@cduck
Copy link
Collaborator

cduck commented Jun 3, 2020

Cirq submodule import times excluding external packages:

Worst load times:
0.569  cirq
0.199  cirq.google
0.137  cirq.qis
0.136  cirq.qis.measures
0.131  cirq.linalg
0.130  cirq.linalg.decompositions
0.126  cirq.google.engine
0.126  cirq.google.engine.engine
0.122  cirq.google.engine.engine_client
0.080  cirq.google.engine.client.quantum
0.080  cirq.google.engine.client.quantum_v1alpha1
0.059  cirq.google.engine.client.quantum_v1alpha1.gapic.quantum_engine_service_client
0.038  cirq.google.devices
0.038  cirq.google.devices.known_devices
0.026  cirq.google.api

@balopat balopat added area/imports area/packages area/performance kind/health For CI/testing/release process/refactoring/technical debt items labels Sep 18, 2020
@dabacon
Copy link
Collaborator Author

dabacon commented Nov 11, 2021

Using tuna, the top offenders are numpy, sympy, matplotlib, pandas, and networkx. We've added code #4653 to do LazyLoading for scipy which was also slow. The good news is that the problem is mostly these external deps, not cirq.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/imports area/packages area/performance kind/health For CI/testing/release process/refactoring/technical debt items
Projects
Status: No status
Development

No branches or pull requests

8 participants