Closed Bug 106796 Opened 23 years ago Closed 19 years ago

Improve GetNameSpaceID() performance

Categories

(Core :: XML, defect, P2)

x86
Windows 2000
defect

Tracking

()

RESOLVED FIXED
mozilla1.9alpha1

People

(Reporter: hjtoi-bugzilla, Assigned: peterv)

References

Details

(Keywords: perf)

Attachments

(1 file)

GetNameSpaceID() can get used a fair amount of time in DHTML applications. For
example on Bugzilla query page clicking on a product and moving the mouse a tiny
bit it can get called about 10 times. Just starting up it is called only 3
times, and it won't be called at all during jrgm's page load tests. It would
need to be tested if it gets called a lot with non-interactive DHTML, like
animations. Anyway, this is not a huge win, GetNameSpaceID() takes about 1ms.

From brendan in bug 41983:
can we deCOMtaminate GetNameSpaceID and its descendents, and also wean
them off of nsHashtable and onto PLDHashTable instead?  That should save a fair
amount of time.

http://lxr.mozilla.org/mozilla/source/content/base/src/nsNameSpaceManager.cpp#476
http://lxr.mozilla.org/mozilla/source/content/base/src/nsNameSpaceManager.cpp#139

I don't see any reason for infallible methods to return NS_OK directly, and to
return their real result via a reference out param.  DeCOMtaminate!

I don't see any reason to subroutine FindNameSpaceID if you can look directly
into a global PLDHashTable with PL_DHashTableOperate(&gURIToIDTable, aURI.get(),
PL_DHASH_LOOKUP), cast the returned entry pointer down to an nsURIToIDEntry*,
and return that entry's mID (or else return kNameSpaceID_Unknown if
PL_DHASH_ENTRY_IS_FREE(entry)).  You'll save on malloc overhead elsewhere, too
(when adding to the table).

If I can help with pldhash.h usage, please let me know.

/be
Summary: Improve GetNameSPaceID() performance → Improve GetNameSpaceID() performance
Priority: -- → P2
Target Milestone: --- → mozilla0.9.7
It doesn't seem like this would be a big win in any situation, futuring.
Target Milestone: mozilla0.9.7 → Future
QA Contact: petersen → rakeshmishra
QA Contact: rakeshmishra → ashishbhatt
Attached patch v1Splinter Review
Assignee: hjtoi-bugzilla → peterv
Status: NEW → ASSIGNED
Blocks: 203448
Comment on attachment 194229 [details] [diff] [review]
v1

I've changed NS_INAMESPACEMANAGER_IID in my tree.
Attachment #194229 - Flags: superreview?(jst)
Attachment #194229 - Flags: review?(jst)
Comment on attachment 194229 [details] [diff] [review]
v1

r+sr=jst
Attachment #194229 - Flags: superreview?(jst)
Attachment #194229 - Flags: superreview+
Attachment #194229 - Flags: review?(jst)
Attachment #194229 - Flags: review+
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Target Milestone: Future → mozilla1.9alpha
You need to log in before you can comment on or make changes to this bug.