Repository navigation
perf(python): release the GIL once per scan export - #10497
robert3005 wants to merge 3 commits into
Conversation
Merging this PR will degrade performance by 38.33%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Simulation | i64_random_chunked[256] |
226.6 µs | 13,908.3 µs | -98.37% |
| ❌ | Simulation | utf8_random[256] |
416.6 µs | 12,969.1 µs | -96.79% |
| ❌ | Simulation | i64_random[256] |
170.2 µs | 3,941.4 µs | -95.68% |
| ❌ | Simulation | nested_list_random[32] |
1 ms | 6.7 ms | -84.48% |
| ❌ |
Simulation | density_sweep_dense_runs[0.001] |
28.7 µs | 47.6 µs | -39.8% |
| ❌ | WallTime | threshold_avx2[8] |
1.9 µs | 2.2 µs | -14.16% |
| ⚡ | Simulation | optimize_lookup_predicate[ids=192, shape=in_list] |
76.4 µs | 51 µs | +49.81% |
| ⚡ | Simulation | optimize_lookup_predicate[ids=128, shape=in_list] |
73.8 µs | 51.7 µs | +42.76% |
| ⚡ | Simulation | optimize_lookup_predicate[ids=64, shape=in_list] |
71.2 µs | 51.5 µs | +38.15% |
| ⚡ | Simulation | optimize_lookup_predicate[ids=16, shape=in_list] |
70 µs | 52.4 µs | +33.66% |
| ⚡ | Simulation | optimize_lookup_predicate[ids=256, shape=in_list] |
105.9 µs | 79.6 µs | +32.93% |
| ⚡ | WallTime | threshold_neon[8] |
3.6 µs | 2.9 µs | +23.65% |
| ⚡ | Simulation | optimize_lookup_predicate[ids=1, shape=in_list] |
90.5 µs | 75.3 µs | +20.26% |
| ⚡ | Simulation | sum_v2_i64 |
224.8 µs | 194.5 µs | +15.6% |
| ⚡ | Simulation | sum_i64 |
224.6 µs | 194.4 µs | +15.55% |
| ⚡ | Simulation | random_i8[0.01] |
124.1 µs | 108.6 µs | +14.29% |
| ⚡ | WallTime | starts_with_avx512[8, VarBin] |
46.4 µs | 40.7 µs | +14.19% |
| ⚡ | Simulation | test_scan_filter[int] |
3.5 ms | 3.1 ms | +13.44% |
| ⚡ | WallTime | filter_neon[80] |
3.5 µs | 3.1 µs | +13.02% |
| ⚡ |
Simulation | random_i128[0.01] |
8.1 µs | 7.2 µs | +11.68% |
| ... | ... | ... | ... | ... | ... |
ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing rk/python-gil (40cfa27) with rk/python-codspeed (029e60c)1
Footnotes
|
Shall we add py benchmarks? |
7e1c579 to
897b789
Compare
0d4b15a to
1081e86
Compare
29bdc1a to
b161762
Compare
ArrayIterator.to_arrow_array reads and exports to Arrow in one GIL release, rather than one for read_all and one for Array.to_arrow_array. Short row index lists are decoded with the GIL held. Signed-off-by: Robert Kruszewski <github@robertk.io> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Robert Kruszewski <github@robertk.io> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
b161762 to
b33b0f0
Compare
Benchmark the single-GIL-release export for scans, repeated scans and filtered scans, with the read_all().to_arrow_array() path as a baseline. Signed-off-by: Robert Kruszewski <github@robertk.io> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Scans that export to Arrow from Python release the GIL fewer times. When other threads hold the GIL, each release costs a wait to take it back.