Closed Bug 122438 Opened 23 years ago Closed 23 years ago

ConvertContractIDKeyToString(...) optimization.

Categories

(Core :: XPCOM, defect, P3)

x86
Windows 2000
defect

Tracking

()

RESOLVED FIXED
mozilla0.9.9

People

(Reporter: dougt, Assigned: neeti)

Details

(Keywords: perf)

Attachments

(4 files)

Why does ConvertContractIDKeyToString(...) in nsComponentManager.cpp create
an intermediate 'nCAutoString' ??

+    const char *contractID = entry->mContractID;
+    nsCAutoString converted;
+
+    converted.Append(contractID);
+
+    wrapper->SetData(converted.get());

It looks like we should be able to do the following:

     wrapper->SetData(entry->mContractID);

In general, ConvertFactoryEntryToCID(...) and ConvertContractIDKeyToString(...)
are incredibly inefficient !!!  Since they are called as enumerator functions we
might want to optimize them a bit ;-)  At the very least it seems like calling
do_CreateInstance() is a bit of a waste since the code is INSIDE OF THE
COMPONENT MANAGER !!  I'm sure there is a faster way to create components ;-)
Neeti, please look at this when you have have a chance.  
Assignee: dougt → neeti
Target Milestone: --- → mozilla0.9.9
doug: could you look at the patch when you get a chance.
Priority: -- → P3
Comment on attachment 68547 [details] [diff] [review]
patch for optimization

why are you going through the nsComponentManager static class?	Cant you just
use the global that should be available since you are in the
nsComponentManagerImpl.
Attachment #68547 - Flags: needs-work+
Attachment #68608 - Flags: needs-work+
Comment on attachment 68608 [details] [diff] [review]
revised patch using global componentManager

just pass the "this" pointer into the "data" closure.
Attached patch revised patchSplinter Review
Attached a revised patch.
Keywords: patch, perf
Comment on attachment 69090 [details] [diff] [review]
revised patch

make sure this compiles xp.  (I am worried that you didn't need to cast
|this|).  
Also, I believe that reinterpret cast is the wrong thing.... you want a static
cast... but I am not totally sure on that.
Other than that, r=dougt.
Attachment #69090 - Flags: review+
Comment on attachment 69264 [details] [diff] [review]
revised patch casting "this", and using NS_STATIC_CAST

sr=alecf
Attachment #69264 - Flags: superreview+
fix checked in
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: