Skip to content

CI: 4h -> 2h (40 min with cache) - #229

Open
kimstik wants to merge 6 commits into
CadQuery:masterfrom
kimstik:fast_build
Open

kimstik wants to merge 6 commits into
CadQuery:masterfrom
kimstik:fast_build

Conversation

@kimstik

@kimstik kimstik commented Sep 20, 2026

Copy link
Copy Markdown

While working on #226 I waited four hours for every CI run of the bindings, most of it on steps that repeat the same work. The same jobs now take about 1h50 from scratch and 37 minutes when the object cache hits, on the same free runners. Six commits, one idea each:

  • N_PROC defaults to the machine's cores instead of 2. -DN_PROC still overrides.
  • pywrap: PCH of the shared preamble, symbol lookup by bisection, smaller collections chunks. Generation on Linux takes 12 minutes instead of 49.
  • The OSX bindings are generated on Linux like the Windows ones, 15 minutes instead of 2h49. Same sources as a native run.
  • PYTHONHASHSEED=0 for bindgen: the generation is reproducible. Two runs give byte-identical sources, so builds can be diffed.
  • Compile with four jobs on every platform, possible once the collections chunks shrank from 5 to 3.2 GB.
  • sccache on the GitHub Actions cache: unchanged sources compile in minutes. Bump SCCACHE_GHA_VERSION to start empty.
before (min) after, empty cache after, cache hits
Generate Linux / Windows / OSX 49 / 34 / 2h49 12 / 14 / 15 same
Compile Linux / Windows / OSX 1h17 / 2h05 / 54 1h04 / 1h21 / 60 2 / 3 / 4
whole run 4h02 ~1h50 37 min

Also fixed:

  • OSX was compiled at -O0 and without the SDK. A space after a line continuation in Compile (Mac).
  • The Windows bindings lacked the members new in occt 8.0.1. The symbols had been dumped from 8.0.0.
  • The generated sources changed from run to run with the hash seed, down to one V3d_ImageDumpOptions member that came and went.
  • pywrap: the default args list of parse_tu grew with every call.

Depends on CadQuery/pywrap#66.

kimstik added 6 commits September 19, 2026 12:31
The default of N_PROC follows the machine; -DN_PROC still overrides it.
OSX target when generating on another host, symbol lookups by bisection (pandas is no longer used), one preamble parse per process, smaller collections chunks.
Same recipe as Windows: the OSX headers come from the SDK the job already downloads, the symbols from the osx-64 occt package (the virtual __osx package has to be declared on a Linux host). The SDK is the sysroot, so that the host's glibc stays out of the include path; the include layout is chosen by PLATFORM, which the native macOS job still sets from the host. The occt version of the symbol dumps is read from environment.devenv.yml, the one place it is pinned; the Windows dump had stayed at 8.0.0, and members new in 8.0.1 were missing from the Windows bindings.
The generator walks sets in many places; with hash randomisation every run orders enums, members and collection chunks differently, and one V3d member came and went. Pinning the seed at the command that runs bindgen covers CI and local builds alike.
The five collections chunks of 100 were 5 GB translation units each and met at the end of the build; at 25 the largest unit is 3.2 GB and four jobs fit the runners. The Mac step had a space after its line continuation, which ended the cmake command before the build type and the SDK: OSX was compiled without optimisation.
sccache with the GitHub Actions cache backend. The generation is reproducible, so the translation units a commit does not touch are hits. SCCACHE_GHA_VERSION namespaces the keys: bumping it starts from an empty cache.
@kimstik
kimstik marked this pull request as draft September 20, 2026 20:56
@kimstik
kimstik marked this pull request as ready for review September 20, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant