1 |
Hi, |
2 |
|
3 |
I use file(1) on a regular basis and I've come across something really |
4 |
strange. |
5 |
|
6 |
I noticed running `file` on info pages takes *ages*. |
7 |
|
8 |
What's confusing, is this: that's not the case with /usr/bin/file. |
9 |
|
10 |
% pwd |
11 |
/usr/share/info |
12 |
% time /usr/bin/file * > /dev/null |
13 |
0.201u 0.018s 0:00.22 95.4% 0+0k 0+0io 0pf+0w |
14 |
% time ~/Gentoo/usr/bin/file * > /dev/null |
15 |
28.371u 0.078s 0:28.56 99.5% 0+0k 0+4io 0pf+0w |
16 |
|
17 |
That is a *HUGE* difference. I don't know why that is. |
18 |
|
19 |
% /usr/bin/file --version |
20 |
file-4.10 |
21 |
magic file from /usr/share/file/magic |
22 |
% ~/Gentoo/usr/bin/file --version |
23 |
file-4.21 |
24 |
magic file from /Users/pipping/Gentoo/usr/share/misc/file/magic |
25 |
|
26 |
I've also compared some more filetypes: |
27 |
|
28 |
% pwd |
29 |
/usr/share/man/man7 |
30 |
% time /usr/bin/file * > /dev/null |
31 |
0.034u 0.011s 0:00.04 100.0% 0+0k 0+0io 0pf+0w |
32 |
% time ~/Gentoo/usr/bin/file * > /dev/null |
33 |
1.423u 0.010s 0:01.44 99.3% 0+0k 0+0io 0pf+0w |
34 |
|
35 |
% pwd |
36 |
/usr/share/ri/1.8/system/YAML |
37 |
% time /usr/bin/file * > /dev/null |
38 |
0.024u 0.009s 0:00.03 66.6% 0+0k 0+0io 0pf+0w |
39 |
% time ~/Gentoo/usr/bin/file * > /dev/null |
40 |
0.049u 0.004s 0:00.05 80.0% 0+0k 0+0io 0pf+0w |
41 |
|
42 |
% pwd |
43 |
/usr/include |
44 |
% time /usr/bin/file * > /dev/null |
45 |
0.176u 0.014s 0:00.19 94.7% 0+0k 0+0io 0pf+0w |
46 |
% time ~/Gentoo/usr/bin/file * > /dev/null |
47 |
3.874u 0.026s 0:03.91 99.4% 0+0k 0+0io 0pf+0w |
48 |
|
49 |
== what i compiled `file` with == |
50 |
|
51 |
% emerge --info | egrep C\(XX\)\?FLAGS |
52 |
CFLAGS="-O3 -march=nocona -fomit-frame-pointer -pipe" |
53 |
CXXFLAGS="-O3 -march=nocona -fomit-frame-pointer -pipe" |
54 |
|
55 |
|
56 |
Kind regards, |
57 |
|
58 |
Elias |
59 |
|
60 |
PS: I ran the above commands multiple times so that time's output |
61 |
stabilized. |
62 |
|
63 |
PPS: don't be tempted to benchmark in /usr/bin or /usr/lib, because |
64 |
/usr/bin/file does a lot more work there, splitting up universal |
65 |
binaries (on x86), hence the benchmarking results become useless. |
66 |
|
67 |
PPPS: I've had a look at Apple's patches to file[1], but I couldn't find |
68 |
one that explains the above behavior. |
69 |
|
70 |
PPPPS: I'm attaching the output of |
71 |
`diff -u /usr/share/file/magic ~/Gentoo/usr/share/misc/file/magic` |
72 |
|
73 |
[1] http://www.opensource.apple.com/darwinsource/Current/file-6.2/patches/ |