speed up opening newsgroup with 10s of thousands of messages, sr=mscott 243237

This commit is contained in:
bienvenu%nventure.com 2004-05-11 16:47:34 +00:00
parent 6f588bb476
commit 8bc1de2e79
5 changed files with 17 additions and 17 deletions

View File

@ -1708,7 +1708,7 @@ PRUint32 nsMsgDatabase::GetStatusFlags(nsIMsgDBHdr *msgHdr, PRUint32 origFlags)
nsMsgKey key;
(void)msgHdr->GetMessageKey(&key);
if (m_newSet.IndexOf(key) != kNotFound)
if (m_newSet.GetSize() > 0 && m_newSet.GetAt(m_newSet.GetSize() - 1) == key || m_newSet.IndexOf(key) != kNotFound)
statusFlags |= MSG_FLAG_NEW;
else
statusFlags &= ~MSG_FLAG_NEW;
@ -2250,7 +2250,9 @@ NS_IMETHODIMP nsMsgDatabase::MarkReadByDate (PRTime startDate, PRTime endDate, n
NS_IMETHODIMP nsMsgDatabase::AddToNewList(nsMsgKey key)
{
if (m_newSet.IndexOf(key) == kNotFound)
// we add new keys in increasing order...
if (m_newSet.GetSize() == 0
|| (m_newSet.GetAt(m_newSet.GetSize() - 1) < key))
m_newSet.Add(key);
return NS_OK;
}
@ -3451,7 +3453,10 @@ nsresult nsMsgDatabase::ThreadNewHdr(nsMsgHdr* newHdr, PRBool &newThread)
PRUint16 numReferences = 0;
PRUint32 newHdrFlags = 0;
newHdr->GetFlags(&newHdrFlags);
// use raw flags instead of GetFlags, because GetFlags will
// pay attention to what's in m_newSet, and this new hdr isn't
// in m_newSet yet.
newHdr->GetRawFlags(&newHdrFlags);
newHdr->GetNumReferences(&numReferences);
#define SUBJ_THREADING 1// try reference threading first

View File

@ -248,7 +248,7 @@ NS_IMETHODIMP nsMsgThread::AddChild(nsIMsgDBHdr *child, nsIMsgDBHdr *inReplyTo,
PRBool parentKeyNeedsSetting = PR_TRUE;
nsIMdbRow *hdrRow = hdr->GetMDBRow();
hdr->GetFlags(&newHdrFlags);
hdr->GetRawFlags(&newHdrFlags);
hdr->GetMessageKey(&newHdrKey);
hdr->GetDateInSeconds(&msgDate);
if (msgDate > m_newestMsgDate)

View File

@ -504,17 +504,12 @@ nsNNTPNewsgroupList::ParseLine(char *line, PRUint32 * message_number)
const char *subject = line; /* #### const evilness */
PRUint32 subjectLen = strlen(line);
PRUint32 flags;
rv = newMsgHdr->GetFlags(&flags);
if (NS_FAILED(rv))
return rv;
PRUint32 flags = 0;
// ### should call IsHeaderRead here...
/* strip "Re: " */
nsXPIDLCString modifiedSubject;
if (NS_MsgStripRE(&subject, &subjectLen, getter_Copies(modifiedSubject)))
flags |= MSG_FLAG_HAS_RE;
rv = newMsgHdr->SetFlags(flags); // this will make sure read flags agree with newsrc
if (NS_FAILED(rv))
return rv;
(void) newMsgHdr->OrFlags(MSG_FLAG_HAS_RE, &flags); // this will make sure read flags agree with newsrc
if (! (flags & MSG_FLAG_READ))
rv = newMsgHdr->OrFlags(MSG_FLAG_NEW, &flags);