Skip to content

Commit 9b65c91

Browse files
authored
perf(build): parallelize mypyc compile with -j $(NPROC) (#7554)
setuptools' build_ext runs serially by default. Pass -j with a cross-platform CPU count so install-devc uses all cores. NPROC comes from python -c "import os; print(os.cpu_count() or 1)" — portable across Linux/macOS/Windows and shells; no dependency on nproc/sysctl.
1 parent 78d2b74 commit 9b65c91

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ endif
88

99
SO_BACKUP := /tmp/sqlglot_so_backup
1010
FIND_SO := find sqlglot -name "*.so"
11+
NPROC := $(shell python -c "import os; print(os.cpu_count() or 1)")
1112

1213
hidec:
1314
rm -rf $(SO_BACKUP) && $(FIND_SO) | tar cf $(SO_BACKUP) -T - 2>/dev/null && $(FIND_SO) -delete; true
@@ -38,10 +39,10 @@ install-dev:
3839
fi
3940

4041
install-devc:
41-
cd sqlglotc && MYPYC_OPT=0 python setup.py build_ext --inplace
42+
cd sqlglotc && MYPYC_OPT=0 python setup.py build_ext --inplace -j $(NPROC)
4243

4344
install-devc-release: clean
44-
cd sqlglotc && python setup.py build_ext --inplace
45+
cd sqlglotc && python setup.py build_ext --inplace -j $(NPROC)
4546

4647
install-pre-commit:
4748
pre-commit install

0 commit comments

Comments
 (0)