[prev in list] [next in list] [prev in thread] [next in thread]
List: kmail-devel
Subject: Patch: better performance for maildir
From: Stephan Kulow <coolo () kde ! org>
Date: 2003-12-01 13:26:04
[Download RAW message or body]
Hi!
As SUSE moves offices, it was decided that moving the NFS
server first was a good idea - so now I have to live with a NFS
connection through the city for a week. Anyway, after watching
kmail compacting folders for two hours, I decided to look at it ;)
The biggest problem is that it calls ::access on non-existant
files for most of the time. So here is my proposed solution: get
the dir listing once and then check string lists instead of asking
the file system file per file. This speeds up exiting kmail on a (slow)
NFS $HOME from hours to minutes.
Greetings, Stephan
--
There may be no I in TEAM, but a M and an E.
["kmail_nfs" (text/x-diff)]
Index: kmfoldermaildir.cpp
===================================================================
RCS file: /home/kde/kdepim/kmail/kmfoldermaildir.cpp,v
retrieving revision 1.74
diff -u -3 -p -u -b -r1.74 kmfoldermaildir.cpp
--- kmfoldermaildir.cpp 29 Nov 2003 18:17:19 -0000 1.74
+++ kmfoldermaildir.cpp 1 Dec 2003 13:01:21 -0000
@@ -238,7 +238,7 @@ int KMFolderMaildir::expungeContents()
{
// nuke all messages in this folder now
QDir d(location() + "/new");
- d.setFilter(QDir::Files);
+ // d.setFilter(QDir::Files); coolo: QFile::remove returns false for non-files
QStringList files(d.entryList());
QStringList::ConstIterator it(files.begin());
for ( ; it != files.end(); ++it)
@@ -263,6 +263,9 @@ int KMFolderMaildir::compact()
QString subdirNew(location() + "/new/");
QString subdirCur(location() + "/cur/");
+ QDir d(subdirNew);
+ QStringList newFiles(d.entryList());
+
for (int i = 0; i < count(); i++)
{
KMMsgInfo *mi = (KMMsgInfo*)mMsgList[i];
@@ -274,8 +277,7 @@ int KMFolderMaildir::compact()
continue;
// first, make sure this isn't in the 'new' subdir
- QString newFile(subdirNew + filename);
- if (QFile::exists(newFile))
+ if ( newFiles.contains( filename ) )
moveInternal(subdirNew + filename, subdirCur + filename, mi);
// construct a valid filename. if it's already valid, then
_______________________________________________
KMail Developers mailing list
kmail@kde.org
https://mail.kde.org/mailman/listinfo/kmail
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic