Skip to content

Commit dbba4cf

Browse files
committed
perf(build): parallelize cython extension compilation
Default `build_ext`'s `parallel` to `os.cpu_count()` so the per-module `gcc` compile step runs in parallel. Wheel builds for emulated archs (riscv64 + armv7l via QEMU) currently spend ~16 of their ~20 minutes serializing 18 `gcc -O3` invocations; on 4-core runners this should drop the compile phase to ~4-5 minutes.
1 parent c96a997 commit dbba4cf

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

build_ext.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646

4747
class BuildExt(build_ext):
4848
def build_extensions(self) -> None:
49+
if self.parallel is None: # type: ignore[has-type]
50+
self.parallel = os.cpu_count() or 1
4951
try:
5052
super().build_extensions()
5153
except Exception:

0 commit comments

Comments
 (0)