Peter's Solaris Zone

Manual Acceleration

The Solaris man command has the capability to create an index of the man pages in a directory (the windex file, created by catman).

This index can be used to speed up manpage searches - if there's no index, then when you ask for (say) the ls man page then the man command has to look in every subdirectory of every directory on your MANPATH to find it, and that's obviously going to slow it down. It's not unusual for the Solaris man command to take several seconds.

Even worse, the default behaviour is now to search the directory hierarchy anyway, even if the windex file exists.

Solaris is often criticized for being slow, and this sort of stupid behaviour really doesn't help.

Enter OpenSolaris

So Solaris is being Open Sourced. This means that I can download the source for the man command, fix the problem and recompile.

So I've done this (it's a single character change) and the results are spectacular:

The Old Way:
0.23u 0.34s 0:03.59 15.8%

The New Way:
0.00u 0.02s 0:00.06 33.3%

That's good! That's a factor of 50 speedup. I can live with that, and the man command generally feels snappy and responsive - like it should.

How to do it right

The bad behaviour was made the default for a bad reason. The argument goes that as Solaris doesn't update the windex file when you upgrade your system (or otherwise change the man pages) then it will be out of sync. OK, that's true, but the correct way to fix this problem is to solve the problem and make sure that the windex file is properly managed, and definitely not to stiff every user with a factor 50 performance hit.

Even better, preformatted man pages and the windex file should be created and installed by default, so that users don't have to run catman (something that - again - runs abysmally slowly on Solaris).

What I suggest as one way of solving the problem is for each package to have its own windex file, and for this to be installed slightly hidden away (say as windex.SUNWman in /usr/share/man/.windices). Then the final stage of adding a man package (or removing it) is to merge the per-package windex files into the master windex.

There are other benefits to this scheme. You don't have to even ship the manpage source files, just the preformatted ones. Man runs faster all the time because it just has to splat the right file to the screen rather than preformatting it. All the options to the man command (like apropos) always work. And you don't need to install any of the formatting software in order to read the manpages.

(The only problem comes when you mix Solaris manpages, which know about this scheme, with alien ones that don't. However, there shouldn't be cases where Solaris and alien manpages get mixed in the same place - that's just asking for trouble.)


Peter's Home | Zone Home