From: cjwatson <> Date: Tue, 14 Jul 2009 15:36:45 +0000 (+0000) Subject: man-db: 'man -K' X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=9d3d0f57b733c72d2232745159e4d7c070e3c9eb;p=blog.git man-db: 'man -K' --- diff --git a/2009-07-14-man-db-K.txt b/2009-07-14-man-db-K.txt new file mode 100644 index 00000000..2e10eb9d --- /dev/null +++ b/2009-07-14-man-db-K.txt @@ -0,0 +1,22 @@ +man-db: 'man -K' + +
I recently implemented man -K
(full-text search over all
+manual pages) in man-db. This was
+inspired by a similar feature in Federico Lucifredi's
+man package
+(formerly maintained by Andries Brouwer). I think I did a much better job of
+it, though. The man package just forks grep for every manual page; man-db
+takes advantage of the pipeline library I wrote for it a while back and does
+it entirely in-process (decompression requires a fork but no exec, while the
+man package has to exec gunzip as well).
The upshot is that, with a hot cache, man-db takes around 40 seconds to +search all manual pages on my laptop; the man package (also with a hot +cache) takes around five minutes, and interactive performance goes down the +drain while it's doing it since it's spawning subprocesses like crazy. If I +limit to a single section, the disparity is closer to 3x than 10x, but it's +still very noticeable. It's interesting how much good libraries can do to +help guide efficient approaches to problems.
+ +Of course, a proper full-text search engine would be much better still, but +that's a project for some other time ...