Optimizing for disk cache?
Waldo Bastian
kde-optimize@mail.kde.org
Tue, 14 Jan 2003 13:26:30 +0100
On Tuesday 14 January 2003 09:43, Stefan Heimers wrote:
> I came up with an idea how to optimize for disk cache:
>
> When linking, group objects in three parts in the following order:
>
> 1. Objects used in every program at startup, before user interaction, in
> order of first call.
I once played with that and got reasonable good results. The problem is that
there is basically no support from the toolchain for it.
Anyway, I abused the gprof mcount hook (which gets called for every function
call when compiled with profiling support) in kdeskd/kmtrace/ktrace, to print
out whenever a function gets called. Then I extracted from this the order in
which functions get called for the first time. Based on this information I
reordered the functions in kdeutils/kedit/kedit.cpp. This resulted in a
measurable reduction of the major page faults when starting kedit.
I think a significant imprvement could be achieved in e.g. libkdecore or libqt
but for that you would need to change the function order across all files and
not just in one file as I did with kedit. That's where toolchain support is
needed.
I was told it is possible to compile files in such a way that each function
ends up in his own linker segment. With a link-map you should then be able to
order the functions. It might be worth to give this a try. I never came to
that.
The other theoretical possibility would be to do some magic with
--enable-final builds.
Cheers,
Waldo
--
bastian@kde.org -=|[ SuSE, The Linux Desktop Experts ]|=- bastian@suse.com