summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2023-04-07 22:58:30 +0200
committerAlejandro Colomar <alx@kernel.org>2023-04-08 00:09:47 +0200
commit0a9ea7be7c04973cc11a827ab2f1a1aba7361dd4 (patch)
tree82e34862a291fb3bdea408e0406b98779a6359f1
parent4693ee33d15d53260c76fdceb8fc3947b27109ef (diff)
bash_aliases: Optimize man_section()
mandoc(1) renders pages much faster than groff(1), which is itself much faster than using man(1). This might seem irrelevant for a single page, but this function is called in a loop in man_lsfunc() and man_lsvar(), where this brings times down considerably. For comparison, `time man_lsfunc man*` took around 55 s (on my system) before this change. With groff(1), it would take around 14 s, and with mandoc(1) (this patch), it takes 4 s. Cc: Ingo Schwarze <schwarze@openbsd.org> Cc: "G. Branden Robinson" <g.branden.robinson@gmail.com> Cc: Gavin Smith <gavinsmith0123@gmail.com> Cc: Dirk Gouders <dirk@gouders.net> Cc: Colin Watson <cjwatson@debian.org> Cc: Eli Zaretskii <eliz@gnu.org> Cc: Larry McVoy <lm@mcvoy.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rw-r--r--scripts/bash_aliases3
1 files changed, 2 insertions, 1 deletions
diff --git a/scripts/bash_aliases b/scripts/bash_aliases
index 9f7d10409..5c0458402 100644
--- a/scripts/bash_aliases
+++ b/scripts/bash_aliases
@@ -65,7 +65,8 @@ man_section()
-e "/^\.SH $s/p" \
-e "/^\.SH $s/,/^\.SH/{/^\.SH/!p}";
done;) \
- |man -P cat -l - 2>/dev/null;
+ |mandoc -Tutf8 2>/dev/null \
+ |col -pbx;
done;
}