共有ライブラリとかキャッシュとか

論点がぼけまくりというのはその通りすぎて、まぁ、なんかあれなんですが。
デスクトップ環境(GNOME とか KDEとか)がアプリケーションの起動高速化のためにライブラリを云々しているということは多分無いんだろうけど、使用する共有ライブラリがメモリにあることは結構期待できそうという要素はありそう。でも、最近の OS なら一度読み込んだプログラムなり共有ライブラリはメモリに余裕がある限りメモリに載せたままにするという話があって、実際問題としてあまり関係ないんじゃないかという話があったり(関係するのはほとんど最初の起動だけ)。
んで、実際には共有ライブラリをリンクした場合は(デスクトップ環境云々は関係なく)リロケーションも発生するわけで、その辺のコスト比はどんな感じだろうとか。prelink を使うと典型的 KDE アプリケーションは起動時間が半分とか言う話があるので、実はリロケーションコストってすごいんじゃねぇのっていう予想が。
と、まぁその辺で自己完結してたわけですが。
gconfd なんかのサーバプロセスが原因で起動速度に差が出るというのは、実際に差があるならその可能性が一番高いかなぁとは思うんだけど、今見てみたら ratpoison の時でも gconfd が動いているっぽいし、実際のところどうなんだろ。D-Bus/ORBit/Bonobo あたりが入ってくると影響ありそうなんだが、その辺はよくわからない。

結局、実際のところはよくわからないのだけど、とりあえず

int main() { return 0; }

なプログラムと、gedit の main を上と同じものに差し替えたものを用意して比較してみた。
起動直後に GDM 経由で ratpoison を起動して xterm の上で。

% time ./empty 
./empty  0.00s user 0.00s system 48% cpu 0.008 total

% time ./empty
./empty  0.00s user 0.00s system 147% cpu 0.003 total

% time ./empty
./empty  0.00s user 0.00s system 138% cpu 0.003 total

% time ./empty
./empty  0.00s user 0.00s system 0% cpu 0.003 total

% time ./gedit 
./gedit  0.02s user 0.00s system 9% cpu 0.210 total

% time ./gedit
./gedit  0.01s user 0.00s system 87% cpu 0.018 total

% time ./gedit
./gedit  0.01s user 0.00s system 86% cpu 0.019 total

同じく GNOME で。

% time ./empty 
./empty  0.00s user 0.00s system 0% cpu 0.014 total

% time ./empty
./empty  0.00s user 0.00s system 142% cpu 0.003 total

% time ./empty
./empty  0.00s user 0.00s system 148% cpu 0.003 total

% time ./gedit 
./gedit  0.01s user 0.01s system 9% cpu 0.216 total

% time ./gedit
./gedit  0.01s user 0.00s system 86% cpu 0.019 total

% time ./gedit
./gedit  0.01s user 0.01s system 108% cpu 0.018 total

まぁ、GDM を経由しているところが微妙だけど。

ちなみにリンクしているライブラリとシンボル数はこんな感じ。

% ldd empty | wc -l
2

% nm -u empty | wc -l
3

% ldd gedit | wc -l
75

% nm -u gedit | wc -l
1220