Repository navigation
Conversation
cmake --build runs the native tool one file at a time unless a jobs count is given, and the CMAKE_BUILD_PARALLEL_LEVEL cache variable in cpp/CMakeLists.txt had no effect: only the environment variable of that name is read. Every Maven C++ build therefore compiled serially, which dominates CI time in the Release + ASan job. Pass --parallel to the compile execution and take the level from CMAKE_BUILD_PARALLEL_LEVEL, which ./mvnw and mvnw.cmd now export with the host core count. A plain mvn falls back to 4 jobs, and -Dcmake.build.parallel.level=N overrides both. build.sh gains -j/--jobs for the same default, and the inert CMakeLists block is removed.
Contributor
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
3 open issues
What changed in this PR
Improve native (C++) build throughput by enabling parallel compilation across Maven and cpp/build.sh, fixing the previously ineffective CMake cache-based parallelism.
Changes:
- Export
CMAKE_BUILD_PARALLEL_LEVELinmvnw/mvnw.cmdand wire it into Maven via an env-activated profile with a4-job fallback. - Pass explicit parallelism to the native build (
cmake --build ... --parallel Nin Maven;make -jNincpp/build.sh). - Update docs/READMEs and remove the inert
CMAKE_BUILD_PARALLEL_LEVELcache-variable logic fromcpp/CMakeLists.txt.
| File | Description |
|---|---|
| skills/tsfile/references/cpp-build-write.md | Documents new parallel build behavior and configuration knobs. |
| mvnw.cmd | Sets CMAKE_BUILD_PARALLEL_LEVEL on Windows wrapper runs. |
| mvnw | Detects core count and exports CMAKE_BUILD_PARALLEL_LEVEL in the Unix wrapper. |
| cpp/pom.xml | Adds --parallel <N> to CMake build and wires env var into a Maven property. |
| cpp/build.sh | Adds --jobs/-j and defaults to detected core count for make -j. |
| cpp/README.md | Documents Maven/build.sh parallel compilation behavior. |
| cpp/README-zh.md | Documents parallel compilation behavior in Chinese README. |
| cpp/CMakeLists.txt | Removes ineffective cache-variable parallelism; adds explanatory comment. |
| cpp/CLAUDE.md | Documents the new parallelism behavior and overrides. |
Review effort: Lite
Verify that each core-count probe actually returns a value before trusting it, and add a getconf _NPROCESSORS_ONLN fallback: sysctl exists on Linux but hw.ncpu does not. Keep CMAKE_BUILD_PARALLEL_LEVEL undefined on Windows when NUMBER_OF_PROCESSORS is missing, and accept -j<n> in build.sh.
Copilot stopped reviewing on behalf of
ColinLeeo due to an error
November 16, 2026 08:04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
cmake --buildran without a jobs count, so the C++ module compiled one translation unit at a time under Maven. TheCMAKE_BUILD_PARALLEL_LEVELcache variable incpp/CMakeLists.txtnever had an effect:cmake --buildonly reads the environment variable of that name.--parallel:mvnw/mvnw.cmdexportCMAKE_BUILD_PARALLEL_LEVELwith the host core count, an env-activated profile forwards it tocmake.build.parallel.level, a plainmvnfalls back to 4 jobs, and-Dcmake.build.parallel.level=Noverrides both.cpp/build.shgains-j=<n>/--jobs=<n>and defaults to the detected core count; the inert CMakeLists block is removed.Why it matters
In the
unit-test (ubuntu-24.04, Release, Asan)job, compilation takes ~62 of the ~69 minutes (371 translation units, one at a time on a 4 vCPU runner), while the 1625 tests take ~6 minutes and are already parallel through ctest. This change lets the compile step use all available cores.Notes
-T; C++ tests were already parallel.Test plan
./mvnw -P with-cpp clean test-compileon a 15-core host logscmake --build ... --parallel 15; clean compile 1:48../mvnw clean verify -P with-java,with-python -Denable.lzma2=ON-> BUILD SUCCESS (258 Java tests, 1624 ctest cases, Python pytest).DEVELOPER_DIR=<Xcode 26> ASAN_OPTIONS=detect_container_overflow=0 ./mvnw clean verify -P with-cpp -Denable.asan=ON -Dbuild.type=RelWithDebInfo -Denable.lzma2=ON-> 1625/1625 tests passed../mvnw spotless:check -P with-java,with-python-> BUILD SUCCESS.