Closed
Bug 104929
Opened 24 years ago
Closed 24 years ago
optimizations for nsStdURL.cpp
Categories
(Core :: Networking, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: sspitzer, Assigned: sspitzer)
Details
Attachments
(1 file)
2.29 KB,
patch
|
sfraser_bugs
:
review+
darin.moz
:
superreview+
|
Details | Diff | Splinter Review |
possible optimizations:
1) use PL_strchr(str,'/'); instead of PL_strstr(str,"/");
2) instead of using PR_smprintf() to append the port, use += and .AppendInt()
(doesn't require a malloc and free)
I'll attach a patch. I got an idea for GetSpec(), but I'll investigate first.
![]() |
Assignee | |
Comment 1•24 years ago
|
||
![]() |
Assignee | |
Comment 2•24 years ago
|
||
one idea for GetSpec() is to fix how we use GetPath()
currently, we do this:
char* ePath = nsnull;
rv = GetPath(&ePath);
if NS_FAILED(rv) {
CRTFREEIF(ePath);
return rv;
}
if (ePath)
{
finalSpec += ePath;
}
If we had something that just appended the path to the existing CAutoString, we
could avoid the allocation.
Comment 3•24 years ago
|
||
I thought darin was doing something close to a rewrite of nsStdUrl, you might
want to wait for him to comment before proceeding with this.
![]() |
Assignee | |
Comment 4•24 years ago
|
||
ok, I'll talk to darin.
another idea:
create a non-scriptable version of GetSpec() that takes a nsCAutoString ref, so
that the caller doesn't have to allocate and free.
most callers seem to use the nsXPIDLCString, but if we passed in a ref to a
CString, we could avoid the malloc and free, assuming the spec was <= 63 bytes
(that's the thresh hold before we copy stack strings to the heap, right?)
![]() |
||
Comment 5•24 years ago
|
||
seth: see bug 103916...
i'm working on redoing nsIURLParser to return offset and length integers,
instead of malloc'd copies of the URL segments. with this new interface, i plan
to modify nsStdURL to hold a full normalized copy of the URL spec along with all
of the offset and length integers for each segment of the URL. doing so should
improve GetSpec and Equals without there being any additional cost to the other
getters. i have also confirmed that the setters are rarely called, so
optimizing them is of no value.
![]() |
||
Comment 6•24 years ago
|
||
Comment on attachment 53653 [details] [diff] [review]
patch
sr=darin (not sure how soon i'll be generating a patch for the URL work i'm talking about, so perhaps it would be worthwhile to land this)
Attachment #53653 -
Flags: superreview+
Comment 7•24 years ago
|
||
Comment on attachment 53653 [details] [diff] [review]
patch
r=sfraser
Attachment #53653 -
Flags: review+
![]() |
Assignee | |
Comment 8•24 years ago
|
||
fixed.
all the fun stuff has moved to #103916.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•