Closed Strilanc closed 6 years ago
============================================================================================= slowest 100 test durations ============================================================================================= 3.62s call cirq/sim/google/xmon_simulator_test.py::test_initial_state[2] 3.54s call cirq/sim/google/xmon_simulator_test.py::test_large_circuit_unitary[2] 3.43s call cirq/sim/google/xmon_simulator_test.py::test_initial_state[0] 3.40s call cirq/sim/google/xmon_simulator_test.py::test_large_circuit_unitary[0] 0.91s call cirq/sim/google/xmon_simulator_test.py::test_xy_y2[2] 0.91s call cirq/sim/google/xmon_simulator_test.py::test_phase_z0[2] 0.91s call cirq/sim/google/xmon_simulator_test.py::test_xy_xy2[2] 0.91s call cirq/sim/google/xmon_simulator_test.py::test_phase_z2[2] 0.91s call cirq/sim/google/xmon_simulator_test.py::test_xy_x1[2] 0.91s call cirq/sim/google/xmon_simulator_test.py::test_xy_x0[2] 0.91s call cirq/sim/google/xmon_simulator_test.py::test_xy_y0[2] 0.91s call cirq/sim/google/xmon_simulator_test.py::test_xy_xy0[2] 0.91s call cirq/sim/google/xmon_simulator_test.py::test_xy_y1[2] 0.91s call cirq/sim/google/xmon_simulator_test.py::test_xy_x2[2] 0.90s call cirq/sim/google/xmon_simulator_test.py::test_phase_z1[2] 0.90s call cirq/sim/google/xmon_simulator_test.py::test_phase_cz01[2-indices3] 0.90s call cirq/sim/google/xmon_simulator_test.py::test_xy_xy1[2] 0.90s call cirq/sim/google/xmon_simulator_test.py::test_phase_cz12[2-indices1] 0.90s call cirq/sim/google/xmon_simulator_test.py::test_phase_cz02[2-indices1] 0.89s call cirq/sim/google/xmon_simulator_test.py::test_phase_cz01[2-indices1] 0.87s call cirq/sim/google/xmon_simulator_test.py::test_phase_cz02[2-indices3] 0.87s call cirq/sim/google/xmon_simulator_test.py::test_phase_cz12[2-indices3] 0.86s call cirq/sim/google/xmon_simulator_test.py::test_multiple_phases[2] 0.86s call cirq/sim/google/xmon_simulator_test.py::test_xy_xy0[0] 0.86s call cirq/sim/google/xmon_simulator_test.py::test_xy_y2[0] 0.86s call cirq/sim/google/xmon_simulator_test.py::test_xy_x1[0] 0.86s call cirq/sim/google/xmon_simulator_test.py::test_xy_y0[0] 0.86s call cirq/sim/google/xmon_simulator_test.py::test_phase_cz02[0-indices0] 0.86s call cirq/sim/google/xmon_simulator_test.py::test_xy_x0[0] 0.86s call cirq/sim/google/xmon_simulator_test.py::test_phase_z1[0] 0.86s call cirq/sim/google/xmon_simulator_test.py::test_xy_y1[0] 0.86s call cirq/sim/google/xmon_simulator_test.py::test_phase_z0[0] 0.86s call cirq/sim/google/xmon_simulator_test.py::test_xy_x2[0] 0.86s call cirq/sim/google/xmon_simulator_test.py::test_phase_cz12[0-indices2] 0.86s call cirq/sim/google/xmon_simulator_test.py::test_xy_xy1[0] 0.86s call cirq/sim/google/xmon_simulator_test.py::test_xy_xy2[0] 0.85s call cirq/sim/google/xmon_simulator_test.py::test_phase_cz01[0-indices2] 0.85s call cirq/sim/google/xmon_simulator_test.py::test_phase_cz02[0-indices2] 0.85s call cirq/sim/google/xmon_simulator_test.py::test_phase_cz01[0-indices0] 0.85s call cirq/sim/google/xmon_simulator_test.py::test_phase_z2[0] 0.84s call cirq/sim/google/xmon_simulator_test.py::test_phase_cz12[0-indices0] 0.83s call cirq/sim/google/xmon_simulator_test.py::test_multiple_phases[0]
Going to add a benchmarking tool
Benchmarks show the xmon simulator is fast and fine. I tracked down the slowness to the multiprocessing Pool close and join when running pytest. There is a way to make the tests faster but I'd like to understand why this is happening in pytest but not with normal python.
Fixed in #15
At the moment, 90% of testing time (~1 minute) is spent in the simulator tests. Making them more performant would save a lot of test time.