Closed
Bug 351731
Opened 18 years ago
Closed 18 years ago
nsParserService::HTMLCaseSensitiveAtomTagToId is slow
Categories
(Core :: DOM: HTML Parser, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: bzbarsky, Assigned: sicking)
References
(Blocks 1 open bug)
Details
(Keywords: perf)
Attachments
(2 files)
(deleted),
patch
|
bzbarsky
:
review+
bzbarsky
:
superreview+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
jst
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
Ran into this while profiling XHTML node creation. Why are we bothering to stringify the atom, hash the string, etc? Imho we should just have a hashtable mapping atoms to IDs here or something.
Assignee | ||
Comment 2•18 years ago
|
||
This patch adds a hash directly from atom -> id. I also inlined some of the functions for additional speed goodness. This forced me to move some of the statics into the class which wasn't too pretty, but I think it's ok.
Attachment #241219 -
Flags: superreview?(bzbarsky)
Attachment #241219 -
Flags: review?(bzbarsky)
Reporter | ||
Comment 3•18 years ago
|
||
Comment on attachment 241219 [details] [diff] [review]
Patch to fix
>Index: parser/htmlparser/public/nsHTMLTags.h
>+ friend void TestTagTable();
Just make that a static member function, perhaps? Otherwise you probably need to declare it separately before the |friend| thing; some of our compilers don't deal with effectively declaring stuff via the |friend| keyword.
>Index: parser/htmlparser/src/nsHTMLTags.cpp
>-static const PRUnichar* const kTagUnicodeTable[] = {
>+const PRUnichar* const nsHTMLTags::sTagUnicodeTable[] = {
This doesn't make me all that happy, but given the inlining I don't see a better way. :(
>+HTMLTagsHashCodeAtom(const void *key)
>+{
>+ return NS_PTR_TO_INT32(key);
Toss in a ">> 2" there because otherwise all keys will end with 00?
With that, looks good.
Attachment #241219 -
Flags: superreview?(bzbarsky)
Attachment #241219 -
Flags: superreview+
Attachment #241219 -
Flags: review?(bzbarsky)
Attachment #241219 -
Flags: review+
Assignee | ||
Comment 4•18 years ago
|
||
Checked in.
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 5•18 years ago
|
||
Attachment #241759 -
Flags: superreview?(jst)
Attachment #241759 -
Flags: review?(jst)
Comment 6•18 years ago
|
||
Comment on attachment 241759 [details] [diff] [review]
Add testing for new code
r+sr=jst
Attachment #241759 -
Flags: superreview?(jst)
Attachment #241759 -
Flags: superreview+
Attachment #241759 -
Flags: review?(jst)
Attachment #241759 -
Flags: review+
You need to log in
before you can comment on or make changes to this bug.
Description
•