Commit aff3efc
authored
Improve inefficient string concatenation in clifford_tableu.py (#8044)
Replaced string concatenation using `+=` with list-based accumulation
and a `"".join()` in `CliffordTableau.__str__()` and
`_row_to_dense_pauli()`. This should improve performance from O(n^2) to
O(n) for the string building operations in that function.1 parent c40e01d commit aff3efc
1 file changed
Lines changed: 14 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
312 | | - | |
| 312 | + | |
313 | 313 | | |
314 | 314 | | |
315 | | - | |
| 315 | + | |
316 | 316 | | |
317 | 317 | | |
318 | 318 | | |
319 | | - | |
| 319 | + | |
320 | 320 | | |
321 | | - | |
| 321 | + | |
322 | 322 | | |
323 | | - | |
| 323 | + | |
324 | 324 | | |
325 | | - | |
| 325 | + | |
| 326 | + | |
326 | 327 | | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
| 328 | + | |
331 | 329 | | |
332 | 330 | | |
333 | 331 | | |
| |||
499 | 497 | | |
500 | 498 | | |
501 | 499 | | |
502 | | - | |
| 500 | + | |
503 | 501 | | |
504 | 502 | | |
505 | 503 | | |
506 | | - | |
| 504 | + | |
507 | 505 | | |
508 | | - | |
| 506 | + | |
509 | 507 | | |
510 | | - | |
| 508 | + | |
511 | 509 | | |
512 | | - | |
513 | | - | |
| 510 | + | |
| 511 | + | |
514 | 512 | | |
515 | 513 | | |
516 | 514 | | |
| |||
0 commit comments