Hi Marc,
Marc Espie wrote on Mon, May 09, 2016 at 06:23:16PM +0200:
> On Mon, May 09, 2016 at 06:11:08PM +0200, Ingo Schwarze wrote:
>> So, bzip2(1) is actually an excellent example.
>>
>> These lines are required:
>>
>> @man man/man1/bzcat.1
>> @man man/man1/bzcmp.1
>> @man man/man1/bzdiff.1
>> @man man/man1/bzegrep.1
>> @man man/man1/bzfgrep.1
>> @man man/man1/bzgrep.1
>> @man man/man1/bzip2recover.1
>> @man man/man1/bzless.1
>> @man man/man1/bzmore.1
>>
>> These two could be commented out:
>>
>> @man man/man1/bzip2.1
>> @man man/man1/bunzip2.1
>>
>> You think any porter would get that right?
>> You feel like coding magic to automate that?
>> You want to deal with bug reports in case it breaks?
>>
>> Part of the reason stuff works so smoothly in the base system is
>> the high quality of base system manuals. They just don't contain
>> weirdness of the kind found in bzip2(1).
> Just a survery of how many MLINKS we're talking about
> would be a good idea.
> Does it make a significant change wrt inode usage
An estimate of an upper bound is easy to come by:
$ cd /usr/ports/
$ find . -name PLIST -exec cat {} \; | wc -l
1377909
$ find . -name PLIST -exec cat {} \; | grep -c '^@man'
35928
So, on average, about 2.5% of files installed by ports, or less
than 40,000 grand total when installing all ports, are manual pages
(MLINKS included). That seems unlikely to be relevant for inode
usage.
> and makewhatis runtime ?
$ rm -f *
$ cp /usr/share/man/man1/ksh.1 .
$ for s in `jot 32739`; do ln ksh.1 ksh${s}.1; done
$ cd ..
$ time makewhatis .
0m02.75s real 0m01.70s user 0m00.99s system
$ rm -f *
$ cp /usr/share/man/man1/ksh.1 .
$ for s in `jot 100`; do cp ksh.1 ksh${s}.1; done
$ cd ..
$ time makewhatis .
0m04.59s real 0m03.71s user 0m00.83s system
$ rm -f *
$ cp /usr/share/man/man1/cat.1 .
$ for s in `jot 1000`; do cp cat.1 cat${s}.1; done
$ cd ..
$ time makewhatis .
0m01.79s real 0m01.64s user 0m00.13s system
So, processing time per MLINK is about 85 microseconds on my notebook,
compared to 45 milliseconds for processing a large manual and to
1.8 milliseconds for processing a small manual. So, a hardlink to
a large manual is 20 time faster than even a small manual. The
reason is that makewhatis(8) internally maintains a hashtable of
inode numbers. If another hardlink is encountered to the same
inode, the file is not opened again. Basically, a hardlink only
costs an additional stat(2). So the hardlinks are unlikely to
matter for processing time.
Yours,
Ingo