Closed Bug 94883 Opened 18 years ago Closed 18 years ago

CreateInstanceByContractID() performance improvement

Categories

(Core :: XPCOM, defect)

x86
Linux
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla0.9.4

People

(Reporter: dpsuresh, Assigned: dp)

References

Details

(Keywords: perf)

Attachments

(2 files)

nsComponentManager::CreateInstance(contractid) used to do two hash lookups :

Contractid --> cid --> factory

This patch changes this to

cid --> factory
Contractid --> factory

Thus eliminates one hash lookup. That is 793 hash looks eliminated on startup.

Timing wise, startup for my went from 26 sec to 25.3 sec
Keywords: perf
Status: UNCONFIRMED → NEW
Ever confirmed: true
Blocks: 7251
Taking over bug.
Assignee: scc → dpsuresh
Wow! I just finished eliminating the nsServiceManager's hashtable and making it
use the componentmanager's hash table to store its services.

Startup went from 25.3 -> 24.6 (0.7 secs improvement).

Once I make the little changes to get the servicemanager::GetService(contractid) to:

instead of doing
ContractidToCID() -> GetService(cid)

do
ContractID->Service

that would eliminate about 2000 hash table lookups. I am expecting atleast
another 1 sec improvement. But this has to wait till tomorrow...
Taking over.
Assignee: dpsuresh → dp
As we discussed, changing the component manager to hash contract IDs directly to
factories is a great idea, and the changes look good. So, r= or sr= waterson on
that part. But the service manager stuff feels hacked, and is probably worth a
deeper iteration to forward most of the functionality on to the component manager.
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9.4
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Fix checked into 0.9.4
You need to log in before you can comment on or make changes to this bug.