Repository navigation
Commit 19264ba
committed
gh-158600: Avoid copying in set.intersection_update()
Calculate all intersections before swapping the final result into the target. Keep the calculation and swap within the same critical section so concurrent updates are not lost.
This keeps the existing unchanged-on-error behavior while removing
the O(len(self)) initial copy.1 parent a644af9 commit 19264ba
1 file changed
Lines changed: 25 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1861 | 1861 | | |
1862 | 1862 | | |
1863 | 1863 | | |
1864 | | - | |
1865 | | - | |
| 1864 | + | |
| 1865 | + | |
| 1866 | + | |
1866 | 1867 | | |
1867 | | - | |
1868 | | - | |
1869 | | - | |
1870 | | - | |
1871 | | - | |
1872 | | - | |
| 1868 | + | |
| 1869 | + | |
| 1870 | + | |
| 1871 | + | |
| 1872 | + | |
| 1873 | + | |
| 1874 | + | |
| 1875 | + | |
| 1876 | + | |
| 1877 | + | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
| 1881 | + | |
| 1882 | + | |
| 1883 | + | |
| 1884 | + | |
| 1885 | + | |
| 1886 | + | |
| 1887 | + | |
| 1888 | + | |
1873 | 1889 | | |
1874 | 1890 | | |
1875 | 1891 | | |
1876 | 1892 | | |
1877 | | - | |
| 1893 | + | |
1878 | 1894 | | |
1879 | 1895 | | |
1880 | 1896 | | |
| |||
0 commit comments