comments on KDE performance tips
Roger Larsson
kde-optimize@mail.kde.org
Fri, 17 Jan 2003 08:28:24 +0100
On Friday 17 January 2003 06:34, Andrew Morton wrote:
> Waldo Bastian <bastian@kde.org> wrote:
> >
> > I think it is possible to let the linker tell the kernel that the whole=
=20
thing=20
> > should be read, but that's a suboptimal solution in that you read a lot=
of=20
> > stuff you rather not read. The best solution is to read what you need i=
n=20
one=20
> > go, and nothing of the stuff that you don't need. Such solution would m=
ean=20
> > that you put all the stuff that you need (at startup) in one continguou=
s=20
part=20
> > of your lib and then the (runtime) linker should tell the kernel that i=
t=20
must=20
> > read all that in.
>=20
> The cost of reading all the blocks in a file is negligibly higher than
> reading (say) half of them.
>=20
> For example, this script:
>=20
> #!/bin/sh
> PROG=3D$(which $1)
> for lib in $(ldd $PROG | cut -d ' ' -f 3)
> do
> cat $lib > /dev/null
> done
> $*
>=20
> when used as
>=20
> ./launch.sh konqueror
>=20
> speeds up the initial launch of konqueror by maybe 2x (didn't bother=20
benching
> it too hard, but the difference is quite plain).
Not for me. It slows it down.
Maybe I have too little memory, or too much debug info in my files.
(full debug compiled)
But loading all small can be a great win... a little program that lists all
shared memory for all programs.
cat /proc/*/maps | sort --key=3D6 -u | sort -n --key=3D5 | awk=20
'BEGIN{limit=3D131072}
; {if ($5 > limit) {print total; limit *=3D 2}; total +=3D $5; printf "% 7s=
%s %s=20
%s
%s\n", $5, $2, $3, $4, $6}; END{print total}'
My final lines read:
2535865 r-xp 00000000 03:07 /opt/qt-copy/plugins/imageformats/libqjpeg.so
2536861 r-xp 00000000 03:07 /opt/qt-copy/plugins/imageformats/libqmng.so
2747510 r-xp 00000000 03:07 /usr/lib/GL/libGL.so.1.3.mesasoft
2748112 r-xp 00000000 03:07 /opt/kdecvs/lib/kde3/plugins/styles/keramik.so
168685464
/RogerL
=2D-=20
Roger Larsson
Skellefte=E5
Sweden