[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-optimize
Subject: Yet more "preloading"
From: Lubos Lunak <l.lunak () suse ! cz>
Date: 2004-03-17 18:09:08
Message-ID: 200403171909.08603.l.lunak () suse ! cz
[Download RAW message or body]
Hello,
while I was already at it ... see the attached patches. This gives me another
improvement 18,5s->15s (that's after the 22,5->18,5 improvement I just
mentioned in the ld.so madvise post, same machine, same plain KDE session).
Looks like I was pretty naive to think the system would be actually good at
quickly loading things from the HDD :(.
The xdm patch is for SUSE's /etc/init.d/xdm , the paths in it are hardcoded
for the moment ($KDEDIR is /opt/_k, $KDEHOME /home/kde2/.k, $QTDIR /opt/_q).
This should be better tested right after reboot, because it seems to be that
the OOM way of clearing the caches doesn't work that well for inodes.
The questions, of course, are now:
- can anybody confirm (and give numbers)?
- which directories should be prescanned. In my case the prescanning took
11,5s , which is noticeably more than the 3s gain. After being more picky
about $KDEDIR/share and scanning only some of its subdirectories, the time of
course went down, but so did the gain. I was thinking along the lines that
there could be a list of directories to scan, most important first, and the
scanning would go in background until the user actually starts startkde. See
the next point.
I actually also tried to do just 'scan /', and but it looks like there's not
much to gain by scanning more. The rest of the difference compared to the
completely (logout->login) cached case seem to be actual loading of files,
which is very likely to be too much to be able to do it.
- where to do this caching. KDM (hello Ossi) and init.d script seem the two
places where this could be done, it takes some time to log in using kdm, and
there are definitely placed during init.d startup when the HDD must be pretty
bored. Ossi, could you please provide some thoughts on this? I don't know how
that works, and there could be two places where to have this caching running,
while typing in kdm, and also while initializing X (at least it seem to be
that while initializing the graphics mode or whatever it's just waiting for
about two seconds and nothing is really happening).
--
Lubos Lunak
KDE developer
---------------------------------------------------------------------
SuSE CR, s.r.o. e-mail: l.lunak@suse.cz , l.lunak@kde.org
Drahobejlova 27 tel: +420 2 9654 2373
190 00 Praha 9 fax: +420 2 9654 2374
Czech Republic http://www.suse.cz/
["xdm.patch" (text/x-diff)]
--- xdm.sav 2004-03-17 18:10:54.000000000 +0100
+++ xdm 2004-03-17 18:09:32.000000000 +0100
@@ -63,6 +63,10 @@ DM=${DISPLAYMANAGER##*/}
rc_reset
case "$1" in
start)
+ /tmp/scan /opt/_k/share \
+ /home/kde2/.k /opt/_k/lib \
+ /opt/_q/lib /opt/_q/plugins \
+ -/lib -/usr/lib &
echo -n "Starting service $DM"
startproc $PIDFILE $DISPLAYMANAGER || rc_failed
# After a crash or a kill signal we may have
["scan.cpp" (text/x-c++src)]
#include <sys/types.h>
#include <dirent.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
void scan( const char* dirname, bool recurse )
{
if( chdir( dirname ) < 0 )
return;
// if( strcmp( dirname, "/dev" ) == 0 )
// return;
// if( strcmp( dirname, "/proc" ) == 0 )
// return;
// static int cnt = 0;
// if( ++cnt % 1000 == 0 )
// fprintf( stderr, "D:%s\n", dirname );
if( DIR* dir = opendir( "." ))
{
while( dirent* file = readdir( dir ))
{
struct stat data;
if( stat( file->d_name, &data ) < 0 )
continue;
// fprintf( stderr, "F:%s\n", file->d_name );
if( strcmp( file->d_name, "." ) == 0
|| strcmp( file->d_name, ".." ) == 0 )
continue;
if( recurse && S_ISDIR( data.st_mode ))
{
// fprintf( stderr, "I:%s\n", file->d_name );
char tmp[ NAME_MAX * 2 + 1 ];
strcpy( tmp, dirname );
// if( strcmp( tmp, "/" ) != 0 )
// strcat( tmp, "/" );
strcat( tmp, file->d_name );
scan( tmp, recurse );
chdir( dirname );
}
}
closedir( dir );
}
}
int main( int argc, char* argv[] )
{
for( int i = 1;
i < argc;
++i )
{
if( argv[ i ][ 0 ] == '-' )
scan( argv[ i ] + 1, false );
else
scan( argv[ i ], true );
}
return 0;
}
_______________________________________________
Kde-optimize mailing list
Kde-optimize@kde.org
https://mail.kde.org/mailman/listinfo/kde-optimize
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic