fix 90452 threading by subject slow when threads are very large, sr=mscott, a=bsmedberg

This commit is contained in:
bienvenu%nventure.com 2005-07-28 14:21:11 +00:00
Родитель d8d22d4dfd
Коммит 279b803590
1 изменённых файлов: 51 добавлений и 37 удалений

Просмотреть файл

@ -290,6 +290,19 @@ NS_IMETHODIMP nsMsgThread::AddChild(nsIMsgDBHdr *child, nsIMsgDBHdr *inReplyTo,
PRBool hdrMoved = PR_FALSE;
nsCOMPtr <nsIMsgDBHdr> curHdr;
// This is an ugly but simple fix for a difficult problem. Basically, when we add
// a message to a thread, we have to run through the thread to see if the new
// message is a parent of an existing message in the thread, and adjust things
// accordingly. If you thread by subject, and you have a large folder with
// messages w/ all the same subject, this code can take a really long time. So the
// pragmatic thing is to say that for threads with more than 1000 messages, it's
// simply not worth dealing with the case where the parent comes in after the
// child. Threads with more than 1000 messages are pretty unwieldy anyway.
// See Bug 90452
if (numChildren < 1000)
{
for (childIndex = 0; childIndex < numChildren; childIndex++)
{
nsMsgKey msgKey;
@ -341,6 +354,7 @@ NS_IMETHODIMP nsMsgThread::AddChild(nsIMsgDBHdr *child, nsIMsgDBHdr *inReplyTo,
}
}
}
}
// If this header is not a reply to a header in the thread, and isn't a parent
// check to see if it starts with Re: - if not, and the first header does start
// with re, should we make this header the top level header?