Skip to content

Commit 6cc238a

Browse files
committed
doc: add minimal sphinx tag that turns off very slow features
The incremental doc build has become too slow again, unusable for interactive use and "drive-by" doc fixes. Add a new `minimal` sphinx tag that groups and optionally disables all features unusable for interactive use. On a 6 years old server with 72 cores and 300G of RAM, this new `minimal` tag reduces `html-fast` build times like this: - Build from scratch: From 4.5 minutes down to 1 minute - Incremental build, one-character .rst change: From 16 seconds down to 9 seconds. Signed-off-by: Marc Herbert <[email protected]> (cherry picked from commit 2f675be6383b4925f4cf74ca86a3c0d8663482f8)
1 parent 91ffb72 commit 6cc238a

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

doc/Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ DT_TURBO_MODE ?= 0
1616
html-fast:
1717
${MAKE} html DT_TURBO_MODE=1
1818

19+
# The `minimal` tag turns off all slow sphinx features for a much faster
20+
# incremental build when editing .rst files interactively. As usual when
21+
# making significant sphinx configuration changes, you must delete
22+
# doc/_build/ first. WARNING: doxygen integration (breathe) will be
23+
# missing, so building from scratch will print a LOT of warnings!
24+
# However this is very useful for small, drive-by .rst fixes.
25+
html-minimal:
26+
${MAKE} html DT_TURBO_MODE=1 SPHINXOPTS='-t minimal ${SPHINXOPTS}'
27+
28+
1929
html latex pdf linkcheck doxygen: configure
2030
cmake --build ${BUILDDIR} --target $@
2131

doc/conf.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,12 @@
6767
# -- General configuration ------------------------------------------------
6868

6969
extensions = [
70-
"breathe",
7170
"sphinx.ext.todo",
7271
"sphinx.ext.extlinks",
7372
"sphinx.ext.autodoc",
7473
"sphinx.ext.graphviz",
7574
"zephyr.application",
7675
"zephyr.html_redirects",
77-
"zephyr.kconfig",
7876
"zephyr.dtcompatible-role",
7977
"zephyr.link-roles",
8078
"sphinx_tabs.tabs",
@@ -86,6 +84,14 @@
8684
"zephyr.external_content",
8785
]
8886

87+
# List of semi-optional features that make the incremental build
88+
# and/or the build from scratch significantly slower.
89+
if not tags.has("minimal"): # pylint: disable=undefined-variable
90+
extensions += [
91+
"breathe",
92+
"zephyr.kconfig",
93+
]
94+
8995
# Only use SVG converter when it is really needed, e.g. LaTeX.
9096
if tags.has("svgconvert"): # pylint: disable=undefined-variable
9197
extensions.append("sphinxcontrib.rsvgconverter")

0 commit comments

Comments
 (0)