quantumlib / Cirq

A Python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.
Apache License 2.0
4.27k stars 1.01k forks source link

Improve slow tests #1339

Closed dabacon closed 4 years ago

dabacon commented 5 years ago

Build times are creeping up. pytest --durations=20

8.30s call cirq/contrib/acquaintance/inspection_utils_test.py::test_get_logical_acquaintance_opportunities[9-4] 4.63s call cirq/google/sim/xmon_stepper_test.py::test_large_circuit_unitary[2-False] 2.69s call cirq/contrib/acquaintance/inspection_utils_test.py::test_get_logical_acquaintance_opportunities[8-4] 2.55s call cirq/google/sim/xmon_stepper_test.py::test_large_circuit_unitary[2-True] 1.50s call cirq/ops/common_gates_test.py::test_phase_sensitive_eigen_gates_consistent_protocols[HPowGate] 1.43s call cirq/ops/common_gates_test.py::test_phase_insensitive_eigen_gates_consistent_protocols[YPowGate] 1.32s call cirq/google/line/placement/anneal_test.py::test_anneal_search_method_calls 1.31s call cirq/ops/common_gates_test.py::test_phase_insensitive_eigen_gates_consistent_protocols[XPowGate] 1.28s call cirq/ops/common_gates_test.py::test_phase_insensitive_eigen_gates_consistent_protocols[ZPowGate] 1.11s call cirq/google/sim/xmon_stepper_test.py::test_precision[2] 1.05s call cirq/ops/pauli_interaction_gate_test.py::test_eq_ne_and_hash 0.91s call examples/examples_test.py::test_example_runs_phase_estimator 0.82s call cirq/google/sim/xmon_stepper_test.py::test_renormalize_state_after_w_gate 0.82s call cirq/google/sim/xmon_stepper_test.py::test_initial_state_computational_basis[2] 0.82s call cirq/google/sim/xmon_stepper_test.py::test_non_context_manager[2] 0.81s call cirq/ops/phased_x_gate_test.py::test_phased_x_consistent_protocols[0.25] 0.80s call cirq/ops/phased_x_gate_test.py::test_phased_x_consistent_protocols[1] 0.80s call cirq/ops/phased_x_gate_test.py::test_phased_x_consistent_protocols[0] 0.79s call cirq/ops/phased_x_gate_test.py::test_phased_x_consistent_protocols[0.5] 0.78s call dev_tools/bash_scripts_test.py::test_pytest_changed_files_branch_selection

dabacon commented 5 years ago

New slowest tests. 4.83s call examples/examples_test.py::test_example_runs_qaoa 3.60s call cirq/experiments/cross_entropy_benchmarking_test.py::test_cross_entropy_benchmarking 2.40s call examples/examples_test.py::test_example_runs_qubit_characterizations 1.94s call dev_tools/bash_scripts_test.py::test_pytest_changed_files_branch_selection 1.85s call dev_tools/bash_scripts_test.py::test_incremental_format_branch_selection 1.76s call dev_tools/bash_scripts_test.py::test_pytest_and_incremental_coverage_branch_selection 1.68s call cirq/linalg/decompositions_perf_test.py::test_kak_decomposition_perf[target0] 1.65s call cirq/contrib/acquaintance/strategies/cubic_test.py::test_cubic_acquaintance_strategy[9] 1.60s call cirq/experiments/qubit_characterizations_test.py::test_two_qubit_randomized_benchmarking 1.46s call examples/examples_perf_test.py::test_example_runs_bcs_mean_field_perf 1.27s call examples/examples_perf_test.py::test_example_runs_hello_line_perf 1.07s call examples/examples_perf_test.py::test_example_runs_superdense_coding 1.05s call cirq/ops/common_gates_test.py::test_phase_insensitive_eigen_gates_consistent_protocols[YPowGate] 1.05s call cirq/google/line/placement/anneal_test.py::test_anneal_search_method_calls 1.04s call examples/examples_perf_test.py::test_example_runs_quantum_fourier_transform_perf 1.04s call examples/examples_perf_test.py::test_example_runs_grover_perf 1.00s call cirq/linalg/decompositions_perf_test.py::test_kak_decomposition_perf[target12] 1.00s call examples/examples_perf_test.py::test_example_runs_bell_inequality_perf 1.00s call dev_tools/bash_scripts_test.py::test_pytest_changed_files_file_selection

dabacon commented 5 years ago

14.08s call cirq/experiments/n_qubit_tomography_test.py::test_state_tomography_diagonal 6.06s call cirq/experiments/cross_entropy_benchmarking_test.py::test_cross_entropy_benchmarking 3.54s call examples/examples_test.py::test_example_runs_qubit_characterizations 2.68s call dev_tools/bash_scripts_test.py::test_pytest_changed_files_branch_selection 2.66s call dev_tools/bash_scripts_test.py::test_incremental_format_branch_selection 2.53s call dev_tools/bash_scripts_test.py::test_pytest_and_incremental_coverage_branch_selection 2.33s call cirq/experiments/qubit_characterizations_test.py::test_two_qubit_randomized_benchmarking 1.79s call examples/examples_perf_test.py::test_example_runs_bcs_mean_field_perf 1.73s call cirq/linalg/decompositions_perf_test.py::test_kak_decomposition_perf[target0] 1.71s call examples/examples_perf_test.py::test_example_runs_hello_line_perf 1.69s call cirq/experiments/n_qubit_tomography_test.py::test_state_tomography_ghz_state 1.64s call cirq/contrib/acquaintance/strategies/cubic_test.py::test_cubic_acquaintance_strategy[9] 1.62s call dev_tools/bash_scripts_test.py::test_pytest_changed_files_file_selection 1.57s call dev_tools/import_test.py::test_no_circular_imports 1.34s call examples/examples_test.py::test_example_runs_hhl 1.19s call examples/examples_perf_test.py::test_example_runs_superdense_coding 1.14s call cirq/ops/phased_x_gate_test.py::test_phased_x_consistent_protocols[0.5] 1.12s call cirq/google/line/placement/anneal_test.py::test_anneal_search_method_calls 1.10s call examples/examples_perf_test.py::test_example_runs_phase_estimator_perf 1.09s call cirq/ops/common_gates_test.py::test_phase_insensitive_eigen_gates_consistent_protocols[XPowGate]

Strilanc commented 5 years ago

I wonder why the bash script tests are so slow? They're running git commands in a temp directory.