Closed Bug 261310 Opened 21 years ago Closed 21 years ago

make it easier to cache factories

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: dbaron, Assigned: dbaron)

Details

(Keywords: perf, Whiteboard: [patch])

Attachments

(1 file, 1 obsolete file)

I'd like to add some functions that make it easier to cache factories and use them in a typesafe way. This is a useful trick for improving the performance of callers that do lots of CreateInstance calls for the same type of object. (The view manager does it for regions, and I'm doing it for script errors in bug 261283.)
Attached patch patchSplinter Review
Attachment #159917 - Attachment is obsolete: true
Comment on attachment 160601 [details] [diff] [review] patch Note that I am adding to nsComponentManagerObsolete, but I don't see any better alternative.
Attachment #160601 - Flags: review?(darin)
Comment on attachment 160601 [details] [diff] [review] patch >Index: xpcom/glue/nsComponentManagerUtils.cpp >+nsCreateInstanceFromFactory::operator()( const nsIID& aIID, void** aInstancePtr ) const ... >+ if (NS_FAILED(status)) >+ *aInstancePtr = 0; >+ if ( mErrorPtr ) nit: whitespace inconsistency (same goes for other methods in this file or so it would appear) nice patch, r=darin :)
Attachment #160601 - Flags: review?(darin) → review+
Fix checked in to trunk, 2004-10-01 17:44 -0700.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Keywords: perf
FWIW, codesize numbers from luna: libxpcom.so Total: +548 (+548/+0) Code: +484 (+484/+0) Data: +64 (+64/+0) +484 (+484/+0) text (CODE) +484 (+484/+0) UNDEF:libxpcom.so:text +158 nsGetClassObjectByContractID::operator()(nsID const&, void**) const +145 nsGetClassObjectByCID::operator()(nsID const&, void**) const +101 nsComponentManager::GetClassObjectByContractID(char const*, nsID const&, void**) +80 nsCreateInstanceFromFactory::operator()(nsID const&, void**) const +64 (+64/+0) data (DATA) +64 (+64/+0) UNDEF:libxpcom.so:data +28 .nosyms.data +12 vtable for nsCreateInstanceFromFactory +12 vtable for nsGetClassObjectByCID +12 vtable for nsGetClassObjectByContractID libgklayout.so Total: -96 (+25/-121) Code: -93 (+0/+0) Data: -3 (+25/-121) -96 (+25/-121) text (DATA) -96 (+25/-121) UNDEF:libgklayout.so:text +25 nsCSSScanner::OutputError() -3 .nosyms.text -52 nsViewManager::CreateRegion(nsIRegion**) -66 nsCSSScanner::InitGlobals()
dbaron, does this mean that the total bloat increased?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: