qiskit-community / ffsim

Faster simulations of fermionic quantum circuits.
https://qiskit-community.github.io/ffsim/
Apache License 2.0
19 stars 5 forks source link

implement apply_num_interaction using apply_phase_shift_in_place #220

Closed kevinsung closed 1 month ago

kevinsung commented 1 month ago

It worsened performance at larger sizes

| Change   | Before [d84ba58f] <main>   | After [9e1bbf13] <pull/220/head>   |   Ratio | Benchmark (Parameter)                                     |
|----------|----------------------------|------------------------------------|---------|-----------------------------------------------------------|
| +        | 1.83±0.01s                 | 3.94±0s                            |    2.15 | gates.GatesBenchmark.time_apply_num_interaction(16, 0.5)  |
| +        | 19.3±0.03ms                | 31.2±0.1ms                         |    1.62 | gates.GatesBenchmark.time_apply_num_interaction(16, 0.25) |
| -        | 225±6μs                    | 89.4±1μs                           |    0.4  | gates.GatesBenchmark.time_apply_num_interaction(12, 0.25) |
| -        | 36.8±0.1μs                 | 8.50±0.06μs                        |    0.23 | gates.GatesBenchmark.time_apply_num_interaction(8, 0.25)  |
| -        | 72.5±0.6μs                 | 16.8±0.09μs                        |    0.23 | gates.GatesBenchmark.time_apply_num_interaction(8, 0.5)   |
| -        | 32.8±0.1μs                 | 6.46±0.05μs                        |    0.2  | gates.GatesBenchmark.time_apply_num_interaction(4, 0.5)   |
| -        | 32.5±0.8μs                 | 6.27±0.02μs                        |    0.19 | gates.GatesBenchmark.time_apply_num_interaction(4, 0.25)  |