Closed
Bug 121485
Opened 24 years ago
Closed 24 years ago
nsXULContentSink is too nsAutoString happy...
Categories
(Core :: XUL, defect, P2)
Core
XUL
Tracking
()
RESOLVED
FIXED
mozilla0.9.9
People
(Reporter: jst, Assigned: jst)
Details
(Keywords: perf, Whiteboard: [HAVE FIX])
Attachments
(1 file, 2 obsolete files)
9.72 KB,
patch
|
nisheeth_mozilla
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
NormalizeAttributeString(), PushNameSpacesFrom(), and ParseTag() in
nsXULContentSink create nsAutoString's (3-4 per attribute, 2 per tag) and copy
string data for doing simple string manipulation that can be done much faster
and w/o any string copying by using string iterators. Patch coming up.
Assignee | ||
Comment 1•24 years ago
|
||
Assignee | ||
Comment 2•24 years ago
|
||
dp, hyatt, would you guys [s]r=?
Status: NEW → ASSIGNED
Keywords: perf
Priority: -- → P2
Whiteboard: [HAVE FIX]
Target Milestone: --- → mozilla0.9.9
Comment 3•24 years ago
|
||
Oy. Lose the paranoid NS_ENSURE_ stuff already! ;-)
Assignee | ||
Comment 4•24 years ago
|
||
Well, I removed some of the NS_ENSURE_* stuff, moved some a bit, and replaced
some with other error checking, but none of them were really paranoid unless we
don't care about OOM situations in this code.
Comment 5•24 years ago
|
||
Comment on attachment 66170 [details] [diff] [review]
Less paranoid error checking...
I still despise NS_ENSURE_*, because it hides flow-of-control changes, and
would prefer:
if (NS_FAILED(rv)) return rv;
wherever they are used. But I'll grant my sr= anyway and grin.
>+ if (mNameSpaceStack.Count() > 0) {
>+ nameSpace =
>+ (nsINameSpace*)mNameSpaceStack.ElementAt(mNameSpaceStack.Count() - 1);
>+ } else {
>+ gNameSpaceManager->CreateRootNameSpace(*getter_AddRefs(nameSpace));
>+ NS_ENSURE_TRUE(nameSpace, NS_ERROR_OUT_OF_MEMORY);
>+ }
The above idiom makes me green around the gills. How about:
if (! nameSpace)
return NS_ERROR_OUT_OF_MEMORY;
instead of |NS_ENSURE_TRUE(...)|.
>+ static const NS_NAMED_LITERAL_STRING(kNameSpaceDef, "xmlns");
>+ static const PRUint32 xmlns_len = kNameSpaceDef.Length();
FWIW, the above is going to cause a global variable access for each use
of xmlns_len, instead of something that can be computed at compile time.
The rest of the string-fu changes look fine.
Attachment #66170 -
Flags: superreview+
Assignee | ||
Comment 6•24 years ago
|
||
I know there are mixed feelings about the NS_ENSURE_* macros, I tend to like
them in most cases since they will actually tell you that something that wasn't
supposed to go wrong went wrong, but you're right, here I was over-using them.
I changed the static length to be a hard coded integer and added an assert that
makes sure that integer matches the length of the string in question.
Assignee | ||
Updated•24 years ago
|
Attachment #66164 -
Attachment is obsolete: true
Attachment #66170 -
Attachment is obsolete: true
Assignee | ||
Updated•24 years ago
|
Attachment #66206 -
Flags: superreview+
Comment 7•24 years ago
|
||
Comment on attachment 66206 [details] [diff] [review]
Fix the issues waterson brought up.
r=nisheeth
Attachment #66206 -
Flags: review+
Assignee | ||
Comment 8•24 years ago
|
||
Fixed.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: jrgmorrison → xptoolkit.widgets
You need to log in
before you can comment on or make changes to this bug.
Description
•