Closed Bug 72899 Opened 23 years ago Closed 16 years ago

fix GetHasSubFolders() and fix nsMsgFolderDataSource::createFolderChildNode to use it

Categories

(MailNews Core :: Database, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: sspitzer, Assigned: Bienvenu)

References

Details

(Keywords: perf)

we only want the first child, we can speed this up.
Depends on: 73395
Keywords: perf
to fix this, I think we want to rewrite createFolderChildNode() to call the 
existing GetHasSubFolders() (which is part of the nsIFolder interface)

but it may not be that simple.

currently, to determine if we have subfolders in createFolderChildNode(), we call 
GetSubFolders()

In the case of news (and probably imap, and local)  GetSubFolders() is overriden 
to discover the subfolders if not initialized.

if we call GetHasSubFolders() directly (which is not overriden) will just return 
the count of mSubFolders, but will not initalize it.

now GetHasSubFolders() is scarying me.  

querying for "hassubfolders" in lxr, it is called in a few places.

we should probably override it (just like we override GetSubFolders()).

for news (and in most cases), GetHasSubFolder() would be overriden like this:

if (!mInitialized) {
	// call GetSubFolders() to initialize mSubFolders
}
// now set the return result, based on the count of mSubFolders

if we do that, then we could fix createFolderChildNode()

comments?
Status: NEW → ASSIGNED
Summary: nsMsgFolderDataSource::createFolderChildNode, don't do GetSubFolders() → fix GetHasSubFolders() and fix nsMsgFolderDataSource::createFolderChildNode to use it
talking to bienvenu, we need nsMsgFolder::GetHasSubFolders() to call
GetSubFolders().  

we need to do this, otherwise mSubFolders might not be properly initialized. 
(GetSubFolders() will initialize if it needs to.)

fixing nsMsgFolderDataSource::createFolderChildNode() to call GetHasSubFolders()
will be prettier, but it will do what it does now, and call GetSubFolders().
But still, isn't it inefficent to get a whole array just to use the first element?
QA Contact: esther → stephend
Would this be a big performance win?  Cavin, might this be something you and 
Seth have already investigated?
Hardware: PC → All
Product: MailNews → Core
sorry for the spam.  making bugzilla reflect reality as I'm not working on these bugs.  filter on FOOBARCHEESE to remove these in bulk.
Assignee: sspitzer → nobody
Status: ASSIGNED → NEW
QA Contact: stephend → database
Assignee: nobody → bienvenu
this is now fixed because GetHasSubfolders creates an enumerator and checks if the enumerator has any elements.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.