1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:24:57 +00:00

Meta: Generate manpages for website in parallel

pandoc is a single-threaded and pretty slow application, so we can run
it in the background and "synchronize" before generating section
indices.

Timing results:
Before:
  Time (abs ≡):        59.833 s [User: 49.541 s, System: 6.943 s]
After:
  Time (abs ≡):        20.440 s [User: 133.928 s, System: 12.290 s]

(both generated with hyperfine -p "rm -r output || true" -r 1
	Meta/build-manpages-website.sh )
This commit is contained in:
kleines Filmröllchen 2023-01-02 16:30:21 +01:00 committed by Jelle Raaijmakers
parent a196fafd0f
commit a205efd900

View file

@ -44,9 +44,13 @@ for md_file in $(find "${MAN_DIR}" -iname '*.md' | ${SORT}); do
--lua-filter=Meta/convert-markdown-links.lua \
--metadata title="${name}(${section_number}) - SerenityOS man pages" \
-o "${output_file}" \
"${md_file}"
"${md_file}" &
done
# Wait for all pandoc executions to finish so that man page indices are always correct.
# shellcheck disable=SC2046 # Word splitting is intentional here
wait $(jobs -p)
# Generate man page listings through pandoc
for section_directory in output/*/; do
section=$(basename "${section_directory}")
@ -78,7 +82,7 @@ for section_directory in output/*/; do
fi
echo "- [${name}](${filename})"
done
)
) &
done
# Generate main landing page listings through pandoc
@ -87,12 +91,12 @@ pandoc -f gfm -t html5 -s \
-B Meta/Websites/man.serenityos.org/banner-preamble.inc \
--metadata title="SerenityOS man pages" \
-o output/index.html \
Meta/Websites/man.serenityos.org/index.md
Meta/Websites/man.serenityos.org/index.md &
pandoc -f gfm -t html5 -s \
-B Meta/Websites/man.serenityos.org/banner-preamble.inc \
--metadata title="Can't run applications" \
-o output/cant-run-application.html \
Meta/Websites/man.serenityos.org/cant-run-application.md
Meta/Websites/man.serenityos.org/cant-run-application.md &
# Copy pre-made files
echo 'Copying images'
@ -108,3 +112,6 @@ while read -r p; do
done < icons.txt
rm icons.txt
# shellcheck disable=SC2046 # Word splitting is intentional here
wait $(jobs -p)