Commit 2644a56
committed
docs: parallelize man page generation with make -j
The man_pages Bazel action invoked 'make bazel-manpages' serially, running
~10,000 pandoc/nroff invocations one at a time (~177s on a 64-core host).
Split the single make call into two phases: 'preprocess' (serial) generates
the md/man*/*.md sources, then 'cat web' fan out pandoc/nroff in parallel with
-j. They cannot share one -j invocation because cat/web read the md files that
preprocess produces and there is no dependency edge forcing preprocess first.
Running 'cat web' as a second invocation also re-parses the Makefile so its
$(wildcard md/man*/*.md) picks up the freshly generated sources.
Job count uses nproc with a sysctl fallback (then 4) so the action also works
on macOS, where nproc is not available by default.
A resource_set reserves the host CPUs for this action so the parallel make
does not oversubscribe other concurrently scheduled Bazel actions; Bazel
clamps the request to the cores actually available.
Regenerating the full doc set drops from ~177s to ~6s (~30x).
Signed-off-by: Matt Liberty <mliberty@precisioninno.com>1 parent b506257 commit 2644a56
1 file changed
Lines changed: 20 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
13 | 21 | | |
14 | 22 | | |
15 | 23 | | |
| |||
18 | 26 | | |
19 | 27 | | |
20 | 28 | | |
21 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
22 | 40 | | |
23 | 41 | | |
24 | 42 | | |
25 | 43 | | |
26 | 44 | | |
27 | 45 | | |
28 | 46 | | |
| 47 | + | |
29 | 48 | | |
30 | 49 | | |
31 | 50 | | |
| |||
0 commit comments